示例#1
0
        public override SteeringOutput getSteering()
        {
            SteeringOutputKinematic steering = new SteeringOutputKinematic();

            steering.velocity = character.position - target.position;

            steering.velocity  = steering.velocity.Normalize(2);
            steering.velocity *= maxSpeed;

            steering.rotation = 0;

            return(steering);
        }
示例#2
0
        public override SteeringOutput getSteering()
        {
            SteeringOutputKinematic steering = new SteeringOutputKinematic();

            steering.velocity = target.position - character.position;

            if (steering.velocity.Norm(2) < satisfactionRadius)
            {
                steering.velocity.Clear();
                steering.rotation = 0;
                return(steering);
            }

            steering.velocity /= timeToTarget;
            if (steering.velocity.Norm(2) > maxSpeed)
            {
                steering.velocity  = steering.velocity.Normalize(2);
                steering.velocity *= maxSpeed;
            }

            steering.rotation = 0;

            return(steering);
        }