コード例 #1
0
        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();
        }
コード例 #2
0
        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();
        }
コード例 #3
0
        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;
                }
            }
        }
コード例 #4
0
 public abstract void OnUnInteract(XRNode hand, GameObject handObject = null, AnimationController handAnimation = null, XRNodeHandController handController = null);
コード例 #5
0
 void Awake()
 {
     handState             = HandState.Free;
     currentHandAnimation  = this.GetComponent <AnimationController>();
     currentHandController = this.GetComponentInParent <XRNodeHandController>();
 }