Skip to content

Commit

Permalink
Adjust scale and position of keyboard with the controller grips, re: #9
Browse files Browse the repository at this point in the history
  • Loading branch information
John Luxford committed Sep 3, 2017
1 parent 624cdaf commit cd43976
Show file tree
Hide file tree
Showing 18 changed files with 688 additions and 1,339 deletions.
1,405 changes: 314 additions & 1,091 deletions Assets/VRKeys/Prefabs/VRKeys.prefab

Large diffs are not rendered by default.

124 changes: 64 additions & 60 deletions Assets/VRKeys/Scenes/VRKeys Example.unity
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.24648565, g: 0.2823304, b: 0.34567446, a: 1}
m_IndirectSpecularColor: {r: 0.18053626, g: 0.2260185, b: 0.30718803, a: 1}
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -90,63 +90,6 @@ NavMeshSettings:
cellSize: 0.16666667
manualCellSize: 0
m_NavMeshData: {fileID: 0}
--- !u!1001 &352954129
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 4000013025176432, guid: f28287b1c722ebd4aa4f4d8547ed7fa8, type: 2}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4000013025176432, guid: f28287b1c722ebd4aa4f4d8547ed7fa8, type: 2}
propertyPath: m_LocalPosition.y
value: 1.35
objectReference: {fileID: 0}
- target: {fileID: 4000013025176432, guid: f28287b1c722ebd4aa4f4d8547ed7fa8, type: 2}
propertyPath: m_LocalPosition.z
value: 2
objectReference: {fileID: 0}
- target: {fileID: 4000013025176432, guid: f28287b1c722ebd4aa4f4d8547ed7fa8, type: 2}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4000013025176432, guid: f28287b1c722ebd4aa4f4d8547ed7fa8, type: 2}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4000013025176432, guid: f28287b1c722ebd4aa4f4d8547ed7fa8, type: 2}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4000013025176432, guid: f28287b1c722ebd4aa4f4d8547ed7fa8, type: 2}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4000013025176432, guid: f28287b1c722ebd4aa4f4d8547ed7fa8, type: 2}
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
- target: {fileID: 114000011813929276, guid: f28287b1c722ebd4aa4f4d8547ed7fa8,
type: 2}
propertyPath: playerSpace
value:
objectReference: {fileID: 585723786}
- target: {fileID: 114000011813929276, guid: f28287b1c722ebd4aa4f4d8547ed7fa8,
type: 2}
propertyPath: leftHand
value:
objectReference: {fileID: 585723785}
- target: {fileID: 114000011813929276, guid: f28287b1c722ebd4aa4f4d8547ed7fa8,
type: 2}
propertyPath: rightHand
value:
objectReference: {fileID: 585723784}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: f28287b1c722ebd4aa4f4d8547ed7fa8, type: 2}
m_IsPrefabParent: 0
--- !u!1001 &585723783
Prefab:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -188,7 +131,7 @@ Prefab:
objectReference: {fileID: 0}
- target: {fileID: 11457864, guid: b0047dd65ff208349bf3a5aaaeae24d0, type: 2}
propertyPath: SteamVREnabled
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 11457864, guid: b0047dd65ff208349bf3a5aaaeae24d0, type: 2}
propertyPath: OculusSDKEnabled
Expand All @@ -210,6 +153,10 @@ Prefab:
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 11457864, guid: b0047dd65ff208349bf3a5aaaeae24d0, type: 2}
propertyPath: PhysicalHands
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: b0047dd65ff208349bf3a5aaaeae24d0, type: 2}
m_IsPrefabParent: 0
Expand Down Expand Up @@ -292,8 +239,65 @@ Transform:
MonoBehaviour:
m_PrefabParentObject: {fileID: 114000011813929276, guid: f28287b1c722ebd4aa4f4d8547ed7fa8,
type: 2}
m_PrefabInternal: {fileID: 352954129}
m_PrefabInternal: {fileID: 1835141285}
m_Script: {fileID: 11500000, guid: fb08f495a9bc93a46b97e507bf9be1b3, type: 3}
--- !u!1001 &1835141285
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 4000013025176432, guid: f28287b1c722ebd4aa4f4d8547ed7fa8, type: 2}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4000013025176432, guid: f28287b1c722ebd4aa4f4d8547ed7fa8, type: 2}
propertyPath: m_LocalPosition.y
value: 1.35
objectReference: {fileID: 0}
- target: {fileID: 4000013025176432, guid: f28287b1c722ebd4aa4f4d8547ed7fa8, type: 2}
propertyPath: m_LocalPosition.z
value: 2
objectReference: {fileID: 0}
- target: {fileID: 4000013025176432, guid: f28287b1c722ebd4aa4f4d8547ed7fa8, type: 2}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4000013025176432, guid: f28287b1c722ebd4aa4f4d8547ed7fa8, type: 2}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4000013025176432, guid: f28287b1c722ebd4aa4f4d8547ed7fa8, type: 2}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4000013025176432, guid: f28287b1c722ebd4aa4f4d8547ed7fa8, type: 2}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4000013025176432, guid: f28287b1c722ebd4aa4f4d8547ed7fa8, type: 2}
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
- target: {fileID: 114000011813929276, guid: f28287b1c722ebd4aa4f4d8547ed7fa8,
type: 2}
propertyPath: playerSpace
value:
objectReference: {fileID: 585723786}
- target: {fileID: 114000011813929276, guid: f28287b1c722ebd4aa4f4d8547ed7fa8,
type: 2}
propertyPath: leftHand
value:
objectReference: {fileID: 585723785}
- target: {fileID: 114000011813929276, guid: f28287b1c722ebd4aa4f4d8547ed7fa8,
type: 2}
propertyPath: rightHand
value:
objectReference: {fileID: 585723784}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: f28287b1c722ebd4aa4f4d8547ed7fa8, type: 2}
m_IsPrefabParent: 0
--- !u!1 &2042955739
GameObject:
m_ObjectHideFlags: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@
using System.Collections;

namespace VRKeys {

/// <summary>
/// Base class for platform-specific haptics.
/// Base class for platform-specific inputs and controller access.
/// </summary>
public class Haptics : MonoBehaviour {
public class Controller : MonoBehaviour {
protected Mallet mallet;

private void Start () {
Expand All @@ -26,5 +25,10 @@ private void Start () {
public virtual void TriggerPulse () {
// Override me!
}

public virtual bool OnGrip () {
// Override me!
return false;
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions Assets/VRKeys/Scripts/HandCollider.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* Copyright (c) 2017 The Campfire Union Inc - All Rights Reserved.
*
* Licensed under the MIT license. See LICENSE file in the project root for
* full license information.
*
* Email: [email protected]
* Website: https://www.campfireunion.com
*/

using UnityEngine;
using System.Collections;

namespace VRKeys {
public class HandCollider : MonoBehaviour {
public Mallet mallet;

public bool inKeyboard = false;

void OnTriggerEnter (Collider other) {
if (other.gameObject.name == "KeyboardCollider") {
inKeyboard = true;
}
}

void OnTriggerExit (Collider other) {
if (other.gameObject.name == "KeyboardCollider") {
inKeyboard = false;
}
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

62 changes: 0 additions & 62 deletions Assets/VRKeys/Scripts/Keyboard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,26 +86,6 @@ public class Keyboard : MonoBehaviour {

public Key[] extraKeys;

public enum KeyboardSize {
Small = 1,
Medium = 2,
Large = 3
}

[Serializable]
public class SizeInfo {
public KeyboardSize size;
public Vector3 position;
public Vector3 scale;
public SizeKey key;
}

[Space (15)]
public KeyboardSize defaultSize = KeyboardSize.Medium;

[SerializeField]
public SizeInfo[] sizes;

[Space (15)]
public bool leftPressing = false;

Expand Down Expand Up @@ -142,8 +122,6 @@ public class KeyboardSubmitEvent : UnityEvent<string> { }

private bool shifted = false;

private KeyboardSize size;

private Layout layout;

/// <summary>
Expand All @@ -159,12 +137,6 @@ private IEnumerator Start () {
UpdateDisplayText ();
PlaceholderVisibility ();

if (PlayerPrefs.HasKey ("vrkeys:size")) {
defaultSize = (KeyboardSize) PlayerPrefs.GetInt ("vrkeys:size");
}

Resize (defaultSize);

initialized = true;
}

Expand Down Expand Up @@ -375,35 +347,6 @@ public void Cancel () {
Disable ();
}

/// <summary>
/// Resize the keyboard.
/// </summary>
/// <param name="newSize">New size.</param>
public void Resize (KeyboardSize newSize) {
DisableInput ();

PlayerPrefs.SetInt ("vrkeys:size", (int) newSize);
size = newSize;

foreach (SizeInfo info in sizes) {
if (info.size == size) {
keyboardWrapper.transform.localPosition = info.position;
keyboardWrapper.transform.localScale = info.scale;
}
info.key.SetActiveSize (size);
}

if (initialized && !disabled) {
StartCoroutine (DelayEnableAfterResize ());
}
}

private IEnumerator DelayEnableAfterResize () {
yield return new WaitForSeconds (0.3f);

EnableInput ();
}

/// <summary>
/// Set the language of the keyboard.
/// </summary>
Expand All @@ -424,11 +367,6 @@ private IEnumerator DoSetLanguage (KeyboardLayout lang) {
foreach (Key key in extraKeys) {
key.UpdateLayout (layout);
}

// Update size keys
foreach (SizeInfo info in sizes) {
info.key.UpdateLayout (layout);
}
}

/// <summary>
Expand Down
6 changes: 0 additions & 6 deletions Assets/VRKeys/Scripts/Layout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,6 @@ public class Layout {

public string clearButtonLabel = "CLEAR";

public string smallButtonLabel = "S";

public string mediumButtonLabel = "M";

public string largeButtonLabel = "L";

public string[] row1Keys = { "`", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "=" };

public string[] row1Shift = { "~", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "_", "+" };
Expand Down
6 changes: 0 additions & 6 deletions Assets/VRKeys/Scripts/Layouts/French.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@ public French () {

clearButtonLabel = "EFFACER";

smallButtonLabel = "P";

mediumButtonLabel = "M";

largeButtonLabel = "G";

row1Keys = new string[] { "â", "&", "é", "\"", "'", "(", "-", "è", "_", "ç", "à", ")", "=" };

row1Shift = new string[] { "ê", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "ë" };
Expand Down
Loading

0 comments on commit cd43976

Please sign in to comment.