PDA

View Full Version : How to make avatars to follow terrain while walking?


yyang
08-03-2008, 08:22 AM
The terrain is not flat. It has small hills and some small items (such as boxes) on it. The terrain is imported from a 3DS file.

My question is how to make avatars walking on this terrain so that their feet are always on the ground or on the small objects on the ground when the avatars are walking. I know it must be related to collision and/or physics.

It would be great if you can post a small piece code here to show how to implement this.

Thanks.

farshizzo
08-04-2008, 02:54 PM
When specifying the position to walk to, you can use a node as the Y value of the position. This will cause the walkTo action to set the height of the avatar to the height of the terrain. Here is an example:import viz
viz.go()

#Add terrain model
terrain = viz.add('tut_ground.wrl',euler=(0,-10,0))

#Create walk action that follows terrain height
walkAction = vizact.walkTo([0,terrain,10])

#Add action to avatar
avatar = viz.add('vcc_female.cfg')
avatar.addAction(walkAction)