Пример #1
0
        /// <summary>
        /// Calculate the dynamic changes to the current object
        /// </summary>
        /// <param name="currentFrame"></param>
        protected void CalculateDynamics(int currentFrame)
        {
            if (lastFrameInterpolated != currentFrame)
            {
                if (currentFrame == 0)
                {
                    velocity = new Vector3();
                    SetMemento(dynamicStartMemento);
                    return;
                }

                lastFrameInterpolated = currentFrame;

                foreach (IDynamic dynamic in dynamicsList)
                {
                    dynamic.Calculate(ref velocity, mass, currentFrame);
                    continue;
                }



                Translate(this.velocity.X + this.Translation.X,
                          this.velocity.Y + this.Translation.Y,
                          this.velocity.Z + this.Translation.Z);

                ActiveRigid collision = new ActiveRigid(this);
                collision.Calculate(ref velocity);
            }
        }
Пример #2
0
        /// <summary>
        /// Calculate the dynamic changes to the current object
        /// </summary>
        /// <param name="currentFrame"></param>
        protected void CalculateDynamics(int currentFrame)
        {
            if(lastFrameInterpolated != currentFrame )
            {
                if(currentFrame == 0)
                {
                    velocity = new Vector3();
                    SetMemento(dynamicStartMemento);
                    return;
                }

                lastFrameInterpolated = currentFrame;

                foreach(IDynamic dynamic in dynamicsList)
                {
                    dynamic.Calculate(ref velocity, mass, currentFrame);
                    continue;
                }

                Translate ( this.velocity.X+ this.Translation.X,
                    this.velocity.Y + this.Translation.Y,
                    this.velocity.Z+ this.Translation.Z);

                ActiveRigid collision = new ActiveRigid(this);
                collision.Calculate(ref velocity);

            }
        }