private void OnSingleUpdate(Valve.VR.SteamVR_Action_Single from, Valve.VR.SteamVR_Input_Sources inputSource, float axis, float delta) { mTimeSinceLast -= Time.deltaTime; Debug.DrawRay(Hand.transform.gameObject.transform.position, Hand.transform.gameObject.transform.forward, Color.blue); if (axis >= 0.5f && mTimeSinceLast <= 0.0f) { Renderer.material = SelectedMaterial; var e = Unity.Entities.World.Active.EntityManager.CreateEntity(); Unity.Entities.World.Active.EntityManager.AddComponentData(e, new RayRequest { Value = new Unity.Physics.Ray { Origin = Hand.transform.position, Displacement = Hand.transform.position + Hand.transform.forward * 100.0f } }); mTimeSinceLast = 0.5f; } else { Renderer.material = DefaultMaterial; } if (Input.GetKeyUp(KeyCode.Space)) { Globals.Instance.data.MeshParent.SetActive(!Globals.Instance.data.MeshParent.activeSelf); Globals.Instance.data.StaticParent.SetActive(!Globals.Instance.data.StaticParent.activeSelf); } }
public OVRInput.Controller GetOculusHand(Valve.VR.SteamVR_Input_Sources handType) { if (handType == Valve.VR.SteamVR_Input_Sources.LeftHand) { return(OVRInput.Controller.LTouch); } else if (handType == Valve.VR.SteamVR_Input_Sources.RightHand) { return(OVRInput.Controller.RTouch); } else { return(OVRInput.Controller.None); } }
private void OnVector2Update(Valve.VR.SteamVR_Action_Vector2 from, Valve.VR.SteamVR_Input_Sources inputSource, Vector2 axis, Vector2 delta) { if (Mathf.Abs(axis.y) >= 0.5f) { var pos = mPlayer.position; pos.y += axis.y * Time.deltaTime * 10.0f; mPlayer.position = pos; var tpPos = TPArea.transform.position; tpPos.y += axis.y * Time.deltaTime * 10.0f; TPArea.transform.position = tpPos; } if (Mathf.Abs(axis.x) >= 0.5f) { var currentRot = mPlayer.transform.rotation.eulerAngles; currentRot.y += axis.x * Time.deltaTime * 50.0f; mPlayer.transform.rotation = Quaternion.Euler(currentRot); } }
private void updateCrossSections(Valve.VR.SteamVR_Behaviour_Pose arg0, Valve.VR.SteamVR_Input_Sources arg1) { pos = pose.origin.position; normal = pose.origin.up; setCrossSections(pose.origin.position, pose.origin.up); }