views:

121

answers:

3

In a soccer game, I am computing a steering force using steering behaviors. This part is ok. However, I am looking for the best way to implement simple 2d human locomotion.

For instance, the players should not "steer" (or simply add acceleration computed from steering force) to its current velocity when the cos(angle) between the steering force and the current velocity or heading vectors is lower than 0.5 because it looks as if the player is a vehicule. A human, when there is an important change of direction, slows down and when it has slowed enough, it starts accelerating in the new direction.

Does anyone have any advice, ideas on how to achieve this behavior? Thanks in advance.

+1  A: 

Make it change direction very quickly but without perfect friction. EG super mario

Edit: but feet should not slide - use procedural animation for feet

tm1rbrt
I don't have that complex graphics, right now it's just simple GDI+ to draw a top-down view of the field and the players.Do you mean that at each step, I should just set the velocity vector in the same direction as the computed acceleration (from steering force) and if the cos(angle) was below a certain value (denoting a big change in direction), I should reset the velocity before adding the acceleration magnitude?This would make the player always go in the right direction and if it has to abruptly change direction, its velocity will go down to zero before reaccelerating.
Alex
+1  A: 

Maybe you could compute the curvature. If the curvature value is to big, the speed slows down. http://en.wikipedia.org/wiki/Curvature

kame
Wouldn't using the cos(angle) between the current velocity and the desired steering force be somewhat equivalent and simpler?
Alex
yes it is simpler
kame
+2  A: 

This is already researched and developed in an initiative called "Robocup". They have a simulation 2D league that should be really similar to what you are trying to accomplish.

Here's a link that should point you to the right direction: http://wiki.robocup.org/wiki/Main_Page

Carlos Aguayo
Yes I know Robocup and you're right, it is very similar to what I am doing. I must admit I haven't checked out the server's source code, but I've seen videos of simulated robocup on youtube. I think the behavior must ressemble something like what I described in cmy comment to tm1rbrt (see above)?
Alex