# animate characters

Hello, everybody… I’m trying to make a 3D game, but I have a few problems: I managed to make a .ASE importer (3ds max) and I have a wonderfull wizard walking. But I don’t know where I have to draw him (I know x, y of course, but how can I have the z?) The floor isn’t plannar, and I’d love the wizard to stay on it… Furthermore, I don’t know when he hits a wall or some other object… Well, How can I do, Please.

You need some basic collision detection to detect the height of the ground at a particle X Z location. You then position your character at this position.

thanks a lot… But could you just precise me how do I make this collision detection… Do I have to make a function which would return the height of the ground??? But I’ll have to test each vertex… it will be very very long?

Spatial partitioning is what you need. Dividing the world polys up into some sort of hierachy like a quad-tree, so you can reject lots of polys from the collision detection tests very quickly.

i.e. Suppose you have a piece of terrain that is square, made up of 40,000 polys. Dividing that terrain into 4 equal squares, gives 10,000 polys per square.

Now if you can determine which square the character is in. (easy coord checking on axis aligned bounding boxes), then we can elimate the other 3 squares, and 30,000 polys with a few simple tests.

Recurse each subdivision down further until you have only 50 or so polys in each node.

There are various other means, but the principle is the same. Reject as many polys from the collision detection as fast as possible.

Nutty

OK… I thank you very much… but I think I’m a little stupid… that’s sure it’s the best way!