Exemplo n.º 1
0
        public Vector2 ComputeForce()
        {
            Vector2 desiredVelocity = OrionMath.VectorNormalize(TargetPosition - Agent.Position) * Agent.MaxSpeed;

            Vector2 steeringVec = desiredVelocity - Agent.Velocity;

            steeringVec = OrionMath.VectorTruncate(steeringVec, Agent.MaxAcceleration);

            return(steeringVec);
        }
Exemplo n.º 2
0
        private Vector2 Seek(Vector2 target)
        {
            Vector2 desiredVelocity = OrionMath.VectorNormalize(target - Agent.Position) * Agent.MaxSpeed;

            Vector2 steeringVec = desiredVelocity - Agent.Velocity;

            steeringVec = OrionMath.VectorTruncate(steeringVec, Agent.MaxAcceleration);

            return(steeringVec);
        }