Пример #1
0
        private KinectIKBone createKinectBone(JointType jointType, String boneSimObjectName, String translationSimObjectName, KinectIKBone parent, Vector3 additionalOffset, SimScene scene, SimSubScene subScene, String additionalName = "")
        {
            dragControl.BoneSimObjectName = boneSimObjectName;

            var targetSimObject = medicalController.getSimObject(dragControl.BoneSimObjectName);
            var ikBone          = targetSimObject.getElement("IKBone") as BEPUikBone;

            ikBone.Pinned = false;

            dragSimObjectDefinition.Name        = jointType + "DragControl" + additionalName;
            dragSimObjectDefinition.Enabled     = allowMovement;
            dragSimObjectDefinition.Translation = medicalController.getSimObject(translationSimObjectName).Translation + additionalOffset;
            SimObjectBase instance = dragSimObjectDefinition.register(subScene);

            medicalController.addSimObject(instance);
            scene.buildScene();

            ikDragSimObjects.Add(instance);

            float distanceToParent = 0;

            if (parent != null)
            {
                distanceToParent = (instance.Translation - parent.Translation).length();
            }

            var bone = new KinectIKBone(jointType, distanceToParent, instance);

            if (parent != null)
            {
                parent.addChild(bone);
            }
            return(bone);
        }
Пример #2
0
 public void destroyIkControls(SimScene scene)
 {
     if (ikDebug != null)
     {
         medicalController.PluginManager.RendererPlugin.destroyDebugDrawingSurface(ikDebug);
         ikDebug = null;
     }
     hips = null;
     ikDragSimObjects.Clear();
 }
Пример #3
0
        public KinectIKFace(KinectIKBone parentBone, float distanceToParent, SimObjectBase faceTargetSimObject)
        {
            leftCP             = ControlPointController.getControlPoint("LeftCP");
            rightCP            = ControlPointController.getControlPoint("RightCP");
            movingMuscle       = MuscleController.getMuscle("MovingMuscleDynamic");
            movingMuscleTarget = MuscleController.MovingTarget;
            neutralProtrusion  = leftCP.NeutralLocation;

            this.parentBone          = parentBone;
            this.distanceToParent    = distanceToParent;
            this.faceTargetSimObject = faceTargetSimObject;
            currentOrientation       = Quaternion.Identity;
        }
Пример #4
0
        public void createIkControls(SimScene scene)
        {
            if (!canConnectToScene())
            {
                return;
            }

            var subScene = scene.getDefaultSubScene();

            ikDebug = medicalController.PluginManager.RendererPlugin.createDebugDrawingSurface("KinectIKDebug", subScene);
            ikDebug.setVisible(debugVisible);

            hips = createKinectBone(JointType.SpineBase, "Pelvis", "Pelvis", null, scene, subScene);
            KinectIKBone hipsLeft  = createKinectBone(JointType.HipRight, "Pelvis", "Pelvis", hips, new Vector3(15, 0, 0), scene, subScene);
            KinectIKBone hipsRight = createKinectBone(JointType.HipLeft, "Pelvis", "Pelvis", hips, new Vector3(-15, 0, 0), scene, subScene);

            KinectIKBone neck = createKinectBone(JointType.SpineShoulder, "UpperTSpineMover", "UpperTSpineMover", hips, scene, subScene);
            KinectIKBone leftShoulderSpine  = createKinectBone(JointType.ShoulderRight, "UpperTSpineMover", "LeftScapula", neck, Vector3.Zero, scene, subScene, "SpineShoulder");
            KinectIKBone rightShoulderSpine = createKinectBone(JointType.ShoulderLeft, "UpperTSpineMover", "RightScapula", neck, Vector3.Zero, scene, subScene, "SpineShoulder");
            KinectIKBone skull = createKinectBone(JointType.Head, "CSpineMover", "CSpineMover", neck, scene, subScene);

            KinectIKBone leftKnee  = createKinectBone(JointType.KneeRight, "LeftFemur", "LeftFemurTibiaJoint", hipsLeft, scene, subScene);
            KinectIKBone leftAnkle = createKinectBone(JointType.AnkleRight, "LeftTibia", "LeftTibiaFootBaseJoint", leftKnee, scene, subScene);
            KinectIKBone leftFoot  = createKinectBone(JointType.FootRight, "LeftFootBase", "LeftFootBase", leftAnkle, new Vector3(0, -2, 5), scene, subScene);

            KinectIKBone rightKnee  = createKinectBone(JointType.KneeLeft, "RightFemur", "RightFemurTibiaJoint", hipsRight, scene, subScene);
            KinectIKBone rightAnkle = createKinectBone(JointType.AnkleLeft, "RightTibia", "RightTibiaFootBaseJoint", rightKnee, scene, subScene);
            KinectIKBone rightFoot  = createKinectBone(JointType.FootLeft, "RightFootBase", "RightFootBase", rightAnkle, new Vector3(0, -2, 5), scene, subScene);

            KinectIKBone leftShoulder = createKinectBone(JointType.ShoulderRight, "LeftScapula", "LeftScapula", neck, scene, subScene);
            KinectIKBone leftElbow    = createKinectBone(JointType.ElbowRight, "LeftHumerus", "LeftHumerusUlnaJoint", leftShoulder, scene, subScene);
            KinectIKBone leftWrist    = createKinectBone(JointType.WristRight, "LeftUlna", "LeftRadiusHandBaseJoint", leftElbow, scene, subScene);
            KinectIKBone leftThumb    = createKinectBone(JointType.ThumbRight, "LeftHandBase", "LeftHandBase", leftWrist, new Vector3(10, 0, 0), scene, subScene);
            KinectIKBone leftHand     = createKinectBone(JointType.HandRight, "LeftHandBase", "LeftHandBase", leftWrist, new Vector3(0, -15, 2), scene, subScene);

            KinectIKBone rightShoulder = createKinectBone(JointType.ShoulderLeft, "RightScapula", "RightScapula", neck, scene, subScene);
            KinectIKBone rightElbow    = createKinectBone(JointType.ElbowLeft, "RightHumerus", "RightHumerusUlnaJoint", rightShoulder, scene, subScene);
            KinectIKBone rightWrist    = createKinectBone(JointType.WristLeft, "RightUlna", "RightRadiusHandBaseJoint", rightElbow, scene, subScene);
            KinectIKBone rightThumb    = createKinectBone(JointType.ThumbLeft, "RightHandBase", "RightHandBase", rightWrist, new Vector3(-10, 0, 0), scene, subScene);
            KinectIKBone rightHand     = createKinectBone(JointType.HandLeft, "RightHandBase", "RightHandBase", rightWrist, new Vector3(0, -15, 2), scene, subScene);

            face             = createKinectFace("CSpineMover", "CSpineMover", skull, Vector3.Forward * 20, scene, subScene);
            face.JawTracking = jawTracking;
        }
Пример #5
0
 private KinectIKBone createKinectBone(JointType jointType, String boneSimObjectName, String translationSimObjectName, KinectIKBone parent, SimScene scene, SimSubScene subScene)
 {
     return(createKinectBone(jointType, boneSimObjectName, translationSimObjectName, parent, Vector3.Zero, scene, subScene));
 }
Пример #6
0
 public void removeChild(KinectIKBone child)
 {
     children.Remove(child);
 }
Пример #7
0
 public void addChild(KinectIKBone child)
 {
     children.Add(child);
 }