Skip to content

Commit

Permalink
Updated input parameters to make popping cubes more responsive and re…
Browse files Browse the repository at this point in the history
…liable

Updated calibration code for ARCore
  • Loading branch information
Chang-Yi Yao committed Dec 16, 2018
1 parent e824824 commit 0da41e9
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 42 deletions.
16 changes: 5 additions & 11 deletions Assets/IncludeVR/Examples/GoreCubes/Scripts/Explodable.cs
Expand Up @@ -32,21 +32,15 @@ void Update()
{
Explode(new Color(0xB2, 0x00, 0x00));
}

if (UnityEngine.Input.GetAxis("Left Trigger") > 0.5f && !exploded)
Debug.Log(UnityEngine.Input.GetAxis("Left Trigger") + " " + UnityEngine.Input.GetAxis("Right Trigger"));
if (UnityEngine.Input.GetAxis("Left Trigger") > 0.5f && !exploded && leftHand.bounds.Intersects(collider.bounds))
{
if (leftHand.bounds.Intersects(collider.bounds))
{
Explode(new Color(0x00, 0x00, 0xB2));
}
Explode(new Color(0x00, 0x00, 0xB2));
}

if (UnityEngine.Input.GetAxis("Right Trigger") > 0.5f && !exploded)
if (UnityEngine.Input.GetAxis("Right Trigger") > 0.5f && !exploded && rightHand.bounds.Intersects(collider.bounds))
{
if (rightHand.bounds.Intersects(collider.bounds))
{
Explode(new Color(0x00, 0xB2, 0x00));
}
Explode(new Color(0x00, 0xB2, 0x00));
}
}

Expand Down
30 changes: 15 additions & 15 deletions Assets/IncludeVR/Examples/GoreCubes/scene.unity
Expand Up @@ -146,7 +146,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
gore: {fileID: 1152654929179750, guid: 1c7d95aa1e44f8f4285ab03fdaf181b4, type: 2}
amountOfGore: 5
explosionForce: 100
explosionForce: 200
leftHand: {fileID: 1651729612}
rightHand: {fileID: 137878997}
--- !u!54 &88653920
Expand Down Expand Up @@ -381,7 +381,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
gore: {fileID: 1152654929179750, guid: 1c7d95aa1e44f8f4285ab03fdaf181b4, type: 2}
amountOfGore: 5
explosionForce: 100
explosionForce: 200
leftHand: {fileID: 1651729612}
rightHand: {fileID: 137878997}
--- !u!54 &525615566
Expand Down Expand Up @@ -498,7 +498,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
gore: {fileID: 1152654929179750, guid: 1c7d95aa1e44f8f4285ab03fdaf181b4, type: 2}
amountOfGore: 5
explosionForce: 100
explosionForce: 200
leftHand: {fileID: 1651729612}
rightHand: {fileID: 137878997}
--- !u!54 &594135983
Expand Down Expand Up @@ -615,7 +615,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
gore: {fileID: 1152654929179750, guid: 1c7d95aa1e44f8f4285ab03fdaf181b4, type: 2}
amountOfGore: 5
explosionForce: 100
explosionForce: 200
leftHand: {fileID: 1651729612}
rightHand: {fileID: 137878997}
--- !u!54 &700863542
Expand Down Expand Up @@ -732,7 +732,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
gore: {fileID: 1152654929179750, guid: 1c7d95aa1e44f8f4285ab03fdaf181b4, type: 2}
amountOfGore: 5
explosionForce: 100
explosionForce: 200
leftHand: {fileID: 1651729612}
rightHand: {fileID: 137878997}
--- !u!54 &779650262
Expand Down Expand Up @@ -849,7 +849,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
gore: {fileID: 1152654929179750, guid: 1c7d95aa1e44f8f4285ab03fdaf181b4, type: 2}
amountOfGore: 5
explosionForce: 100
explosionForce: 200
leftHand: {fileID: 1651729612}
rightHand: {fileID: 137878997}
--- !u!54 &779654603
Expand Down Expand Up @@ -1175,7 +1175,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
gore: {fileID: 1152654929179750, guid: 1c7d95aa1e44f8f4285ab03fdaf181b4, type: 2}
amountOfGore: 5
explosionForce: 100
explosionForce: 200
leftHand: {fileID: 1651729612}
rightHand: {fileID: 137878997}
--- !u!54 &1041704412
Expand Down Expand Up @@ -1462,7 +1462,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
gore: {fileID: 1152654929179750, guid: 1c7d95aa1e44f8f4285ab03fdaf181b4, type: 2}
amountOfGore: 5
explosionForce: 100
explosionForce: 200
leftHand: {fileID: 1651729612}
rightHand: {fileID: 137878997}
--- !u!54 &1134629795
Expand Down Expand Up @@ -1744,7 +1744,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
gore: {fileID: 1152654929179750, guid: 1c7d95aa1e44f8f4285ab03fdaf181b4, type: 2}
amountOfGore: 5
explosionForce: 100
explosionForce: 200
leftHand: {fileID: 1651729612}
rightHand: {fileID: 137878997}
--- !u!1 &1241238325
Expand Down Expand Up @@ -1780,7 +1780,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
gore: {fileID: 1152654929179750, guid: 1c7d95aa1e44f8f4285ab03fdaf181b4, type: 2}
amountOfGore: 5
explosionForce: 100
explosionForce: 200
leftHand: {fileID: 1651729612}
rightHand: {fileID: 137878997}
--- !u!54 &1241238328
Expand Down Expand Up @@ -2046,7 +2046,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
gore: {fileID: 1152654929179750, guid: 1c7d95aa1e44f8f4285ab03fdaf181b4, type: 2}
amountOfGore: 5
explosionForce: 100
explosionForce: 200
leftHand: {fileID: 1651729612}
rightHand: {fileID: 137878997}
--- !u!54 &1410652279
Expand Down Expand Up @@ -2163,7 +2163,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
gore: {fileID: 1152654929179750, guid: 1c7d95aa1e44f8f4285ab03fdaf181b4, type: 2}
amountOfGore: 5
explosionForce: 100
explosionForce: 200
leftHand: {fileID: 1651729612}
rightHand: {fileID: 137878997}
--- !u!54 &1411607957
Expand Down Expand Up @@ -2364,7 +2364,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
gore: {fileID: 1152654929179750, guid: 1c7d95aa1e44f8f4285ab03fdaf181b4, type: 2}
amountOfGore: 5
explosionForce: 100
explosionForce: 200
leftHand: {fileID: 1651729612}
rightHand: {fileID: 137878997}
--- !u!54 &1553953740
Expand Down Expand Up @@ -2481,7 +2481,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
gore: {fileID: 1152654929179750, guid: 1c7d95aa1e44f8f4285ab03fdaf181b4, type: 2}
amountOfGore: 5
explosionForce: 100
explosionForce: 200
leftHand: {fileID: 1651729612}
rightHand: {fileID: 137878997}
--- !u!54 &1635269515
Expand Down Expand Up @@ -2832,7 +2832,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
gore: {fileID: 1152654929179750, guid: 1c7d95aa1e44f8f4285ab03fdaf181b4, type: 2}
amountOfGore: 5
explosionForce: 100
explosionForce: 200
leftHand: {fileID: 1651729612}
rightHand: {fileID: 137878997}
--- !u!54 &1836184428
Expand Down
6 changes: 3 additions & 3 deletions Assets/IncludeVR/Examples/Shared/Prefabs/DeviceModel.prefab
Expand Up @@ -22,7 +22,7 @@ GameObject:
- component: {fileID: 33226474189094796}
- component: {fileID: 65751591231190352}
- component: {fileID: 23540108320766262}
- component: {fileID: 114203618946530112}
- component: {fileID: 114760010606908882}
m_Layer: 0
m_Name: DeviceModel
m_TagString: Untagged
Expand Down Expand Up @@ -270,15 +270,15 @@ BoxCollider:
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &114203618946530112
--- !u!114 &114760010606908882
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1190025140563096}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 395780741, guid: e5c15f99994d65e4eab2b6a1366479dc, type: 3}
m_Script: {fileID: 11500000, guid: c3310c5951168ed4ea644f8e3aa1e908, type: 3}
m_Name:
m_EditorClassIdentifier:
screen: {fileID: 1389327432933506}
Binary file modified Assets/IncludeVR/Plugins/ViewR.dll
Binary file not shown.
8 changes: 2 additions & 6 deletions Assets/IncludeVR/Scripts/ARCoreTracker.cs
Expand Up @@ -32,7 +32,7 @@ void Update()
Input.OriginRotation * pose.rotation : Quaternion.Slerp(t.rotation, Input.OriginRotation * trackerRotation, Time.unscaledDeltaTime * Config.rotlerp));

trackerPosition = (Config.poslerp == 0 ?
Input.OriginRotation * trackerPosition : Vector3.Lerp(t.position, Input.OriginRotation * trackerPosition, Time.unscaledDeltaTime * Config.poslerp));
Input.OriginPosition + Input.OriginRotation * trackerPosition : Vector3.Lerp(t.position, Input.OriginPosition + Input.OriginRotation * trackerPosition, Time.unscaledDeltaTime * Config.poslerp));

for (int i = 0; i < 3; i++)
{
Expand All @@ -49,11 +49,7 @@ void Update()
trackerPosition = (Config.poslerp == 0 ?
trackerPosition : Vector3.Lerp(t.localPosition, trackerPosition, Time.unscaledDeltaTime * Config.poslerp));

for(int i = 0; i < 3; i++)
{
trackerPosition[i] *= t.localScale[i];
}

for(int i = 0; i < 3; i++) trackerPosition[i] *= t.localScale[i];
t.localPosition = trackerPosition;
}
}
Expand Down
2 changes: 1 addition & 1 deletion Assets/IncludeVR/Scripts/AttachARCoreTracker.cs
Expand Up @@ -29,7 +29,7 @@ void OnConnect(DeviceInfo info, GameObject client)
ARCoreTracker tracker = client.AddComponent<ARCoreTracker>();
if(tracker == null)
{
Logger.Log("AttachARCoreTracker.OnConnect: why the fuck is this null?");
Logger.Log("AttachARCoreTracker.OnConnect: why the hell is this null?");
} else
{
Logger.Log("AttachARCoreTracker.OnConnect: tracker attached");
Expand Down
12 changes: 6 additions & 6 deletions ProjectSettings/InputManager.asset
Expand Up @@ -285,9 +285,9 @@ InputManager:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 1000
dead: 0.001
sensitivity: 1000
gravity: 0.5
dead: 0.01
sensitivity: 1
snap: 0
invert: 0
type: 2
Expand All @@ -301,9 +301,9 @@ InputManager:
positiveButton:
altNegativeButton:
altPositiveButton:
gravity: 1000
dead: 0.001
sensitivity: 1000
gravity: 0.5
dead: 0.01
sensitivity: 1
snap: 0
invert: 0
type: 2
Expand Down

0 comments on commit 0da41e9

Please sign in to comment.