public override void update(Clock clock, EventManager eventManager)
        {
            Vector3 bonePos = bone.getDerivedPosition();

            if (bonePos != lastPosition)
            {
                Vector3 position = Quaternion.quatRotate(boneObject.Rotation, bonePos) + boneObject.Translation;
                joint.setFrameOffsetB(bone.getDerivedPosition());
                lastPosition = bonePos;
                SleepyActorRepository.wakeUp();
            }
            if (translate)
            {
                float newLocation = location;
                if (location < targetLocation)
                {
                    newLocation += moveSpeed * clock.DeltaSeconds;
                    if (location > targetLocation)
                    {
                        location  = targetLocation;
                        translate = false;
                    }
                }
                else
                {
                    newLocation -= moveSpeed * clock.DeltaSeconds;
                    if (location <= targetLocation)
                    {
                        location  = targetLocation;
                        translate = false;
                    }
                }
                setLocation(newLocation);
            }
        }
        public void positionModified()
        {
            Vector3 newLocation = disc.getPosition(location);

            this.updateTranslation(ref newLocation);
            SleepyActorRepository.wakeUp();
            if (PositionChanged != null)
            {
                PositionChanged.Invoke(this, location);
            }
        }
Example #3
0
 public void changeForce(float force)
 {
     if (this.force != force)
     {
         this.force = force;
         SleepyActorRepository.wakeUp();
         if (ForceChanged != null)
         {
             ForceChanged.Invoke(this, force);
         }
     }
 }
Example #4
0
        protected override void constructed()
        {
            sceneNodeElement = Owner.getElement(sceneNodeName) as SceneNodeElement;
            if (sceneNodeElement == null)
            {
                blacklist("Could not find SceneNodeElement {0}.", sceneNodeName);
            }
            entity = sceneNodeElement.getNodeObject(entityName) as Entity;
            if (entity == null)
            {
                blacklist("Could not find Entity {0}.", entityName);
            }

            actorElement = Owner.getElement(actorName) as RigidBody;
            if (actorElement == null)
            {
                blacklist("Could not find Actor {0}.", actorName);
            }
            SleepyActorRepository.addSleeper(actorElement);

            joint = Owner.getElement(jointName) as Generic6DofConstraintElement;
            if (joint == null)
            {
                blacklist("Could not find Joint {0}.", jointName);
            }
            startingLocation = joint.getFrameOffsetOriginA();
            startingRotation = joint.getFrameOffsetBasisA();

            transparency = Owner.getElement(transparencyInterface) as TransparencyInterface;
            if (transparency == null)
            {
                blacklist("Could not find TransparencyInterface {0}", transparencyInterface);
            }
            TeethController.addTooth(Owner.Name, this);
            HighlightColor = Color.White;
        }
Example #5
0
 protected override void destroy()
 {
     TeethController.removeTooth(Owner.Name);
     SleepyActorRepository.removeSleeper(actorElement);
 }