[ODE] player walking movement (was: Suitability to my application )

Chris Campbell chris.campbell at l8tech.com
Sun Aug 25 22:54:01 2002


This is perhaps beside the point, but I found a way of making a character
move which feels pretty realistic:
You have a sphere which your player is inside, and this sphere behaves like
one of the wheels of the buggy in the buggytest (on community page). So to
move, you spin the sphere in the appopriate direction with
dBodySetAngularVel. To stop moving set angular vel to zero. By just doing
this you can let ODE take care of linear velocity. I really like this
because by adjusting the friction between the sphere and the ground you can
get cool side effects. eg you can't go from standing still to running
instantaneously, when going uphill there will be a point where a slope is
just too steep to go up further, when going downhill you sometimes get that
'cant stop' feeling (if you dont know what I mean trying running very fast
down a steep hill and try to stop quickly :) ) and you are guaranteed not to
go doing any physically impossible Quake3-style steering in mid-air. Oh and
one more thing, you know those wooden walls that they have at army physical
training or whatever, they're about 8-9 feet high or so I think - um...
anyway, you usually cant just stand next to them and climb over, but with a
run and a jump you can probably grab the top and have enough upwards
momentum to be most of the way over - this works realistically too! Just
standing next to a vertical wall and walking into it will get you nowhere
much, but if you take a run up and jump at it, you can get fairly high up.
Its not surprising this is realistic though, I mean when we walk after all
what do we do? Basically, put a foot on the ground and push backwards right?

Well if you want realistic then it's good... otherwise... maybe not.

> Positioning the player by setting velocity is a reasonably 
> happy medium between the total physics-unfriendliness of 
> setting position and the loose control provided by forces. 
> Rather than saying what position you want to be in each 
> frame, calculate how fast you need to be moving to reach your 
> target position and set the velocity on your physics body accordingly.
> 
> This has many of the same benefits as forces. If your 
> character hits a wall, he'll either stop or slide along it. 
> If he steps off a cliff, he'll start to fall, and if he hits 
> a slope he'll climb up it. Little rises and falls in the 
> ground will be automatically incorporated into your 
> character's movement, and you still have pretty tight 
> frame-to-frame control of your character's movement; he won't 
> go flying off down a hill if you're setting his speed each 
> frame, and you won't get an unfortunate confluence of 
> external influences causing him to fly through the air.