Sign in to follow this  

About steering and velocity

This topic is 1281 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I was reading couple of tutorials regarding steering behaviour and there is one thing that confuses me.
To calculate position for my agent i need to sum up all steer forces and accumulate into velocity:

steerForce = calculateSteeringForces();
steerForce.truncate(maxForce);
velocity += steerForce;
velocity.truncate(maxSpeed);
position += velocity;

I will take seek behaviour for example:
desiredVel = normalize(target - agent.position) * maxVel;
return desiredVel - agent.velocity;

and at some point i need to stop my agent from moving, should i check magnitude of steerForce like:
steerForce = calculateSteeringForces();
if(steerForce.length() < epsilon)
    return; //stop
steerForce.truncate(maxForce);
velocity += steerForce;
velocity.truncate(maxSpeed);
position += velocity;

because velocity is always > 0.

Share this post


Link to post
Share on other sites

This topic is 1281 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this