public override void OnUnInteract(XRNode hand, GameObject handObject = null, AnimationController handAnimation = null, XRNodeHandController handController = null) { inUse = false; rb.isKinematic = false; this.transform.SetParent(originalParent); InheritVelocity(); if (currentHandController != null) { currentHandController.active = true; } if (currentHandAnimation != null) { currentHandAnimation.ResetController(); } currentHandAnimation = null; currentHandController = null; if (dataReader != null) { dataReader.active = false; } OnUnGrab.Invoke(); }
public override void OnInteract(XRNode hand, GameObject handObject = null, AnimationController handAnimation = null, XRNodeHandController handController = null) { inUse = true; currentHandController = handController; currentHandAnimation = handAnimation; this.transform.SetParent(handObject.transform.parent); rb.isKinematic = true; VelocityEstimator estimator = this.GetComponent <VelocityEstimator>(); if (estimator == null) { estimator = this.gameObject.AddComponent <VelocityEstimator>(); } estimator.BeginEstimatingVelocity(); if (dataReader != null) { dataReader.ApplyData(hand, currentHandAnimation, currentHandController); } OnGrab.Invoke(); }
public void ApplyData(XRNode handNode, AnimationController handAnimator, XRNodeHandController handController) { if (data != null) { switch (handNode) { case XRNode.LeftHand: if (data.useRotation) { this.transform.localEulerAngles = data.leftHandObjRotation; } active = data.usePosition; targetPos = data.leftHandObjPosition; targetRot = data.leftHandObjRotation; if (handAnimator != null && data.useAnimationProfile) { if (handController != null) { handController.active = false; } handAnimator.SetAnimatorWithProfile(data.leftHandProfile); } break; case XRNode.RightHand: this.transform.localEulerAngles = data.rightHandObjRotation; active = true; targetPos = data.rightHandObjPosition; targetRot = data.rightHandObjRotation; if (handAnimator != null && data.useAnimationProfile) { if (handController != null) { handController.active = false; } handAnimator.SetAnimatorWithProfile(data.rightHandProfile); } break; default: Debug.Log("Wrong Node Sent"); break; } } }
public abstract void OnUnInteract(XRNode hand, GameObject handObject = null, AnimationController handAnimation = null, XRNodeHandController handController = null);
void Awake() { handState = HandState.Free; currentHandAnimation = this.GetComponent <AnimationController>(); currentHandController = this.GetComponentInParent <XRNodeHandController>(); }