public static Quaternion GetRotation(ViveHand hand) { GetInstance(); if (!IsValid(hand)) { return(Quaternion.identity); } var obj = hand == ViveHand.Left ? inst.leftObj : inst.rightObj; return(obj.transform.rotation); }
public static Vector3 GetPosition(ViveHand hand) { GetInstance(); if (!IsValid(hand)) { return(Vector3.zero); } var obj = hand == ViveHand.Left ? inst.leftObj : inst.rightObj; return(obj.transform.position); }
public static Vector3 GetAngularVelocity(ViveHand hand) { GetInstance(); if (!IsValid(hand)) { return(Vector3.zero); } var dev = hand == ViveHand.Left ? inst.leftDevice : inst.rightDevice; return(dev.angularVelocity); }
public static Vector2 GetTouchPoint(ViveHand hand) { GetInstance(); if (!IsValid(hand)) { return(Vector2.zero); } var dev = hand == ViveHand.Left ? inst.leftDevice : inst.rightDevice; return(dev.GetAxis(EVRButtonId.k_EButton_SteamVR_Touchpad)); }
public static float GetTriggerValue(ViveHand hand) { GetInstance(); if (!IsValid(hand)) { return(0f); } var dev = hand == ViveHand.Left ? inst.leftDevice : inst.rightDevice; return(dev.GetAxis(EVRButtonId.k_EButton_SteamVR_Trigger).x); }
public static bool GetButtonUp(ViveHand hand, ViveButton button) { GetInstance(); if (!IsValid(hand)) { return(false); } var dev = hand == ViveHand.Left ? inst.leftDevice : inst.rightDevice; return(dev.GetPressUp((ulong)button)); }
public static Transform GetTransform(ViveHand hand) { GetInstance(); if (!IsValid(hand)) { return(inst.transform); } var obj = hand == ViveHand.Left ? inst.leftObj : inst.rightObj; return(obj.transform); }
public static void Vibrate(ViveHand hand, float strength, float duration) { GetInstance(); if (!IsValid(hand)) { return; } var dev = hand == ViveHand.Left ? inst.leftDevice : inst.rightDevice; inst.StartCoroutine(VibrationCoroutine(dev, (ushort)(strength * 3999), duration)); //dev.TriggerHapticPulse((ushort)(strength * 3999)); }
public override void StopInteract(ViveHand hand) { if (fj = hand.GetComponent <FixedJoint>()) { objectToGrab.isKinematic = prevKinematicValue; if (objectToGrab.useGravity) { objectToGrab.velocity = hand.Velocity(); objectToGrab.angularVelocity = hand.AngularVelocity(); } fj.connectedBody = null; Destroy(fj); } interacted = false; hand.UnmakeBusy(); }
private void UpdateHandPosition(ViveHand hand) { if (body) { handX = body.transform.InverseTransformPoint(hand.transform.position).x; handY = body.transform.InverseTransformPoint(hand.transform.position).y; } else { if (!debugDisplayed) { Debug.Log("No SliderBody was registered on slider " + name + "!"); debugDisplayed = true; } } }
public override void StartInteract(ViveHand hand) { if (objectToGrab) { fj = hand.gameObject.AddComponent <FixedJoint>(); fj.breakForce = 20000; fj.breakTorque = 20000; fj.connectedBody = objectToGrab; prevKinematicValue = objectToGrab.isKinematic; objectToGrab.isKinematic = false; interacted = true; hand.MakeBusy(); } }
public static bool IsValid(ViveHand hand) { GetInstance(); if (hand == ViveHand.Unknown) { return(false); } var dev = hand == ViveHand.Left ? inst.leftDevice : inst.rightDevice; if (dev == null) { return(false); } return(dev.valid); }
public override void StopInteract(ViveHand hand) { interacted = false; grabbingHand = null; pressed = false; }
public abstract void StartInteractDelayed(ViveHand hand);
public override void StopInteract(ViveHand hand) { interacted = false; Unpress(); }
// Use this for initialization void Start() { hand = ViveInput.GetHand(gameObject.transform.parent.parent.gameObject); line = GetComponent <LineRenderer>(); }
public override void StartInteract(ViveHand hand) { interacted = true; Press(); }
public override void StartInteractDelayed(ViveHand hand) { }
// Use this for initialization void Start() { hand = ViveInput.GetHand(gameObject); cols = new Collider[10]; }
public override void StartInteract(ViveHand hand) { interacted = true; grabbingHand = hand; pressed = true; }
public abstract void StopInteract(ViveHand hand);