Ejemplo n.º 1
0
        private void GrabAttemp(Grabbable grabbable, float amount)
        {
            snapBack = false;
            if (grabbable == null)
            {
                currentGhost = null;
                this.puppet.SetDefaultPose();
                return;
            }
            SnappableObject snappable = grabbable.Snappable;

            if (snappable != null)
            {
                HandSnapPose userPose = this.puppet.CurrentPoseTracked(snappable.transform);

                HandGhost ghost = snappable.FindNearsetGhost(userPose, out float score, out var bestPlace);
                if (ghost != null)
                {
                    currentGhost = ghost;
                    poseInVolume = currentGhost.AdjustPlace(bestPlace);
                    offsetAmount = grabbingAmount = amount;
                }
                else
                {
                    currentGhost = null;
                    offsetAmount = grabbingAmount = 0f;
                }
            }
        }
Ejemplo n.º 2
0
        private void GrabStarted(Grabbable grabbable)
        {
            SnappableObject snappable = grabbable.Snappable;

            if (snappable != null)
            {
                HandSnapPose userPose = this.puppet.CurrentPoseTracked(snappable.transform);
                HandGhost    ghost    = snappable.FindNearsetGhost(userPose, out float score, out var bestPlace);

                if (ghost != null)
                {
                    currentGhost   = ghost;
                    poseInVolume   = currentGhost.AdjustPlace(bestPlace);
                    grabbingAmount = 1f;
                    offsetAmount   = 1f;
                    grabStartTime  = Time.timeSinceLevelLoad;
                    snapBack       = grabbable.CanMove && snappable.HandSnapBacks;
                    this.puppet.TransitionToPose(poseInVolume, currentGhost.RelativeTo, grabbingAmount, 1f);
                }
            }
        }