private void GhostEditFingers()
        {
            HandPuppet puppet = _handGhost.GetComponent <HandPuppet>();

            if (puppet != null && puppet.JointMaps != null)
            {
                DrawBonesRotator(puppet.JointMaps);
            }
        }
Exemple #2
0
        public void OnSceneGUI()
        {
            HandPuppet puppet = (target as HandPuppet);

            if (puppet?.Bones != null)
            {
                DrawBonesRotator(puppet.Bones, puppet);
            }
        }
Exemple #3
0
        /// <summary>
        /// Creates a new SnapPoint at the exact pose of a given hand.
        /// Mostly used with Hand-Tracking at Play-Mode
        /// </summary>
        /// <param name="puppet">The user controlled hand.</param>
        /// <returns>The generated SnapPoint.</returns>
        public SnapPoint AddSnapPoint(HandPuppet puppet)
        {
            HandPose  rawPose   = puppet.TrackedPose(this.transform, true);
            SnapPoint snapPoint = GenerateSnapPoint();

            snapPoint.SetPose(rawPose, this.transform);
            snapPoint.LoadGhost(ghostProvider);

            return(snapPoint);
        }
        public void OnSceneGUI()
        {
            HandGhost  ghost  = (target as HandGhost);
            HandPuppet puppet = ghost.GetComponent <HandPuppet>();

            if (puppet?.Bones != null)
            {
                DrawBonesRotator(puppet.Bones, puppet);
            }
        }
        private void CreateGhost()
        {
            if (_ghostVisualsProvider == null)
            {
                return;
            }

            HandGhost ghostPrototype = _ghostVisualsProvider.GetHand(_handGrabPoint.HandPose.Handedness);

            _handGhost = GameObject.Instantiate(ghostPrototype, _handGrabPoint.transform);
            _handGhost.gameObject.hideFlags = HideFlags.HideAndDontSave;
            _handGhost.SetPose(_handGrabPoint);
            _ghostPuppet = _handGhost.GetComponent <HandPuppet>();
        }
Exemple #6
0
        public override void OnInspectorGUI()
        {
            DrawDefaultInspector();

            HandPuppet puppet = target as HandPuppet;

            if (GUILayout.Button("Auto-Assign Bones"))
            {
                SkinnedMeshRenderer skinnedHand = puppet.GetComponentInChildren <SkinnedMeshRenderer>();
                if (skinnedHand != null)
                {
                    SetPrivateValue(puppet, "_jointMaps", AutoAsignBones(skinnedHand));
                }
            }
        }
        private void DrawBonesRotator(List <BoneMap> bones, HandPuppet puppet)
        {
            float     scale        = 0.25f;
            Matrix4x4 handleMatrix = Matrix4x4.TRS(
                Vector3.zero,
                Quaternion.identity,
                Vector3.one * scale);

            using (new Handles.DrawingScope(handleMatrix))
            {
                foreach (var bone in bones)
                {
                    Quaternion rotation = Handles.RotationHandle(bone.transform.rotation, bone.transform.position / scale);
                    bone.transform.rotation = rotation;
                }
            }
        }
Exemple #8
0
 private void Reset()
 {
     puppet = this.GetComponent <HandPuppet>();
     root   = this.GetComponentInChildren <Animator>()?.transform ?? this.transform;
 }
Exemple #9
0
 private void Reset()
 {
     puppet  = this.GetComponent <HandPuppet>();
     grabber = this.GetComponent <IGrabNotifier>() as Component;
 }
Exemple #10
0
 private void Reset()
 {
     puppet = this.GetComponent <HandPuppet>();
 }