Example #1
0
 public void update()
 {
     boneState  = MandibleController.createMandibleState();
     discState  = DiscController.createDiscState();
     teethState = TeethController.createTeethState();
     fossaState = FossaController.createState();
 }
Example #2
0
 public void blend(FossaState target, float percent)
 {
     foreach (String key in positions.Keys)
     {
         Fossa fossa = FossaController.get(key);
         if (fossa != null)
         {
             float start = positions[key];
             float end   = target.positions[key];
             float delta = end - start;
             fossa.setEminanceDistortion(start + delta * percent);
         }
     }
 }
Example #3
0
        protected override void constructed()
        {
            curve = new CatmullRomSpline3d();

            FossaController.add(this);
            SimObject eminanceSimObject = Owner.getOtherSimObject(eminanceName);

            if (eminanceSimObject == null)
            {
                blacklist("Cannot find the eminance SimObject {0}", eminanceName);
            }

            eminanceOffset = eminanceSimObject.Translation;
            SceneNodeElement eminanceSceneNode = eminanceSimObject.getElement(eminanceNodeName) as SceneNodeElement;

            if (eminanceSceneNode == null)
            {
                blacklist("Cannot find the eminance scene node {0}", eminanceNodeName);
            }

            Entity eminanceEntity = eminanceSceneNode.getNodeObject(eminanceEntityName) as Entity;

            if (eminanceEntity == null)
            {
                blacklist("Cannot find the eminance entity {0}", eminanceEntityName);
            }

            if (!eminanceEntity.hasSkeleton())
            {
                blacklist("Eminance entity {0} does not have a skeleton.", eminanceEntityName);
            }

            SkeletonInstance skeleton = eminanceEntity.getSkeleton();

            for (int i = 1; skeleton.hasBone(fossaBoneBaseName + i); ++i)
            {
                Bone bone = skeleton.getBone(fossaBoneBaseName + i);
                eminanceBones.Add(bone);
                bone.setManuallyControlled(true);
            }

            SimObject skullSimObject = Owner.getOtherSimObject(skullName);

            if (skullSimObject == null)
            {
                blacklist("Could not find a skull SimObject named {0}.", skullName);
            }

            skullOffset = skullSimObject.Translation;
            SceneNodeElement skullNode = skullSimObject.getElement(skullNodeName) as SceneNodeElement;

            if (skullNode == null)
            {
                blacklist("Could not find skull node {0}.", skullNodeName);
            }

            Entity skullEntity = skullNode.getNodeObject(skullEntityName) as Entity;

            if (skullEntity == null)
            {
                blacklist("Could not find skull entity {0}.", skullEntityName);
            }

            if (!skullEntity.hasSkeleton())
            {
                blacklist("Skull entity {0} does not have a skeleton.", skullEntityName);
            }

            skeleton = skullEntity.getSkeleton();
            Vector3 eminanceTrans = Vector3.Zero;

            for (int i = 1; skeleton.hasBone(fossaBoneBaseName + i); ++i)
            {
                Bone bone = skeleton.getBone(fossaBoneBaseName + i);
                skullBones.Add(bone);
                bone.setManuallyControlled(true);
                Vector3 trans = bone.getDerivedPosition() + skullSimObject.Translation - this.Owner.Translation;
                trans.x = 0;
                basePoints.Add(trans);
                if (i < eminanceStart)
                {
                    eminanceDistort.Add(trans);
                    eminanceTrans = trans;
                }
                else
                {
                    trans.y = eminanceTrans.y;
                    eminanceDistort.Add(trans);
                }
            }

            foreach (Vector3 point in basePoints)
            {
                curve.addControlPoint(point);
            }

            //Find the control point
            SimObject controlPointObj = Owner.getOtherSimObject(controlPointObject);

            if (controlPointObj == null)
            {
                blacklist("Could not find controlPointObject {0}.", controlPointObject);
            }

            controlPoint = controlPointObj.getElement(controlPointBehavior) as ControlPointBehavior;
            if (controlPoint == null)
            {
                blacklist("Could not find controlPointBehavior {0}.", controlPointBehavior);
            }
        }
Example #4
0
 protected override void destroy()
 {
     FossaController.remove(this);
 }