/** Updates hand position and rotation */ void UpdateHand(HandTracker hand) { bool bControllerActive = IsControllerActive(hand.m_controller); if (bControllerActive) { if (hand.Equals(triggerHand)) { hand.transform.localPosition = (hand.m_controller.Position - hand.m_baseOffset) * m_sensitivity + triggerInitialPosition; } //hand.transform.localPosition = (hand.m_controller.Position - hand.m_baseOffset) * m_sensitivity + hand.transform.InverseTransformPoint(handTarget_Trigger.transform.position); else { hand.transform.localPosition = (hand.m_controller.Position - hand.m_baseOffset) * m_sensitivity + forgripInitialPosition; } //hand.transform.localPosition = (hand.m_controller.Position - hand.m_baseOffset) * m_sensitivity + hand.transform.InverseTransformPoint(handTarget_Forgrip.transform.position); //hand.transform.position = handTarget_Trigger.transform.position; //hand.transform.position = (hand.m_controller.Position - hand.m_baseOffset) * m_sensitivity + hand.InitialPosition; //hand.transform.localPosition = (hand.m_controller.Position - hand.m_baseOffset) * m_sensitivity + hand.InitialPosition; //hand.transform.position = (hand.m_controller.Position - hand.m_baseOffset) * m_sensitivity + hand.m_resetPosition; if (forgripHand.m_controller.GetButton(SixenseButtons.TRIGGER) && hand.Equals(triggerHand)) { hand.transform.LookAt(forgripHand.transform); } else { hand.transform.localRotation = (hand.m_controller.Rotation * Quaternion.Inverse(hand.m_baseRotation)); } //hand.transform.rotation = handTarget_Trigger.transform.rotation; } else { // use the inital position and orientation because the controller is not active hand.transform.position = hand.InitialPosition; hand.transform.rotation = hand.InitialRotation; } }
/** Updates hand position and rotation */ void UpdateHand(HandTracker hand) { bool bControllerActive = IsControllerActive(hand.m_controller); if (bControllerActive) { if(hand.Equals(triggerHand)) hand.transform.localPosition = (hand.m_controller.Position - hand.m_baseOffset) * m_sensitivity + triggerInitialPosition; //hand.transform.localPosition = (hand.m_controller.Position - hand.m_baseOffset) * m_sensitivity + hand.transform.InverseTransformPoint(handTarget_Trigger.transform.position); else hand.transform.localPosition = (hand.m_controller.Position - hand.m_baseOffset) * m_sensitivity + forgripInitialPosition; //hand.transform.localPosition = (hand.m_controller.Position - hand.m_baseOffset) * m_sensitivity + hand.transform.InverseTransformPoint(handTarget_Forgrip.transform.position); //hand.transform.position = handTarget_Trigger.transform.position; //hand.transform.position = (hand.m_controller.Position - hand.m_baseOffset) * m_sensitivity + hand.InitialPosition; //hand.transform.localPosition = (hand.m_controller.Position - hand.m_baseOffset) * m_sensitivity + hand.InitialPosition; //hand.transform.position = (hand.m_controller.Position - hand.m_baseOffset) * m_sensitivity + hand.m_resetPosition; if (forgripHand.m_controller.GetButton(SixenseButtons.TRIGGER) && hand.Equals(triggerHand)) { hand.transform.LookAt(forgripHand.transform); } else { hand.transform.localRotation = (hand.m_controller.Rotation * Quaternion.Inverse(hand.m_baseRotation)); } //hand.transform.rotation = handTarget_Trigger.transform.rotation; } else { // use the inital position and orientation because the controller is not active hand.transform.position = hand.InitialPosition; hand.transform.rotation = hand.InitialRotation; } }