Skip to content

Commit

Permalink
merging de la branche controller
Browse files Browse the repository at this point in the history
  • Loading branch information
FHomps committed Feb 12, 2019
1 parent 7373c2e commit d753d83
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 1 deletion.
34 changes: 34 additions & 0 deletions ReViVD_unity_project/Assets/Controllers.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using UnityEngine;
using UnityEngine.XR;

public class Controllers : MonoBehaviour
{
GameObject leftHand;
GameObject rightHand;

// Start is called before the first frame update
void Start()
{
leftHand = GameObject.CreatePrimitive(PrimitiveType.Cube);
leftHand.transform.localScale = new Vector3(0.1f, 0.1f, 0.2f);
leftHand.transform.parent = Camera.main.transform.parent;
rightHand = GameObject.CreatePrimitive(PrimitiveType.Cube);
rightHand.transform.localScale = new Vector3(0.1f, 0.1f, 0.2f);
rightHand.transform.parent = Camera.main.transform.parent;
}

// Update is called once per frame
void Update()
{
leftHand.transform.localRotation = InputTracking.GetLocalRotation(XRNode.LeftHand);
leftHand.transform.localPosition = InputTracking.GetLocalPosition(XRNode.LeftHand) + new Vector3(0, 2, 0) - (0.1f * leftHand.transform.forward);
rightHand.transform.localRotation = InputTracking.GetLocalRotation(XRNode.RightHand);
rightHand.transform.localPosition = InputTracking.GetLocalPosition(XRNode.RightHand) + new Vector3(0, 2, 0) - (0.1f * rightHand.transform.forward);

}
}

/* Notes :
* InputTracking.GetLocalPosition(XRNode.Head) == Camera.main.transform.localPosition - new Vector3(0, 2, 0)
* Ceci ne dépend pas de la position de cameraHolder.
*/
11 changes: 11 additions & 0 deletions ReViVD_unity_project/Assets/Controllers.cs.meta

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

42 changes: 41 additions & 1 deletion ReViVD_unity_project/Assets/Scenes/SampleScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ Camera:
y: 0
width: 1
height: 1
near clip plane: 0.3
near clip plane: 0.1
far clip plane: 5000
field of view: 60
orthographic: 0
Expand Down Expand Up @@ -256,6 +256,46 @@ Transform:
m_Father: {fileID: 2015733476}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &917125379
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 917125381}
- component: {fileID: 917125380}
m_Layer: 0
m_Name: Controllers
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &917125380
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 917125379}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f374cc148f3e89f4285d8db0eb411e32, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!4 &917125381
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 917125379}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 2.3992636, y: 84.67823, z: 60.125717}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &932146886
GameObject:
m_ObjectHideFlags: 0
Expand Down

0 comments on commit d753d83

Please sign in to comment.