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);
            }
        }
Esempio n. 3
0
 public void changeForce(float force)
 {
     if (this.force != force)
     {
         this.force = force;
         SleepyActorRepository.wakeUp();
         if (ForceChanged != null)
         {
             ForceChanged.Invoke(this, force);
         }
     }
 }