jefflunt / pedestrians

(retired) A pedestrian simulation tech demo
7 stars 3 forks source link

I've got a twitch! #29

Closed jefflunt closed 13 years ago

jefflunt commented 13 years ago

Pedestrians suddenly turn to the left, then correct back toward the path for some reason.

jefflunt commented 13 years ago

If you slow the walking speed down to 3 pixels/second, you can see that this is actually happening several times from one waypoint to another.

The path pull vector seems to be correcting it, so what happens if you turn it off? Do they move off into space?

jefflunt commented 13 years ago

When you turn off the path correction vector, the effect goes away.

jefflunt commented 13 years ago

The twitch has been corrected. Basically, if a pedestrian was even slightly turned aside from their target direction, they would make a steering adjustment. Since the direction a pedestrian is heading is measured to a pretty high precision, this basically meant that pedestrians were always at least a little bit off the mark. This lead to corrective steering almost constantly, and the twitch behavior.

So, now the pedestrian will only correct their steering if their current direction is more than 45 degrees (1/8th of a circle) off the mark. As a nice side effect, this actually makes for more loose, natural looking steering. as opposed to robot-like precision.

This coding change will be in the next major release.