Intersection of player and mesh

Posted by Will on Game Development See other posts from Game Development or by Will
Published on 2012-09-04T21:10:08Z Indexed on 2012/09/04 21:51 UTC
Read the original article Hit count: 178

I have a 3D scene, and a player that can move about in it.

In a time-step the player can move from point A to point B. The player should follow the terrain height but slow going up cliffs and then fall back, or stop when jumping and hitting a wall and so on.

In my first prototype I determine the Y at the player's centre's X,Z by intersecting a ray with every triangle in the scene. I am not checking their path, but rather just sampling their end-point for each tick. Despite this being Javascript, it works acceptably performance-wise.

a bad collision; player shouldn't be half-out of the room

However, because I am modeling the player as a single point, the player can position themselves so that they are half-in a cliff face and so on. I need to model them as as a solid e.g. some cluster of spheres or a even their fuller mesh. I am also concerned that if they were moving faster they might miss the test altogether.

How should I solve this?

© Game Development or respective owner

Related posts about collision-detection

Related posts about geometry