Jump to content

View more

Image of the Day

Inventory ! Va falloir trouver une autre couleur pour le cadre D: #AzTroScreenshot #screenshotsaturday https://t.co/PvxhGL7cOH
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

About steering and velocity

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
1 reply to this topic

#1 belfegor   Members   

2833
Like
0Likes
Like

Posted 15 June 2014 - 09:35 AM

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.

#2 ApochPiQ   Moderators   

22551
Like
2Likes
Like

Posted 15 June 2014 - 06:03 PM

"Seek" will rarely give you a force that results in stopping. If you want to land on a specific target, you should use the "Arrive" force.
Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.