Jump problem identify floor

Started by
1 comment, last by Kurt-olsson 11 years, 6 months ago
Hi. I have a problem in my fps game engine. I cant seem to figure och which triangles in my level that is the floor.
Basically now the player can jump again as soon as i touch any wall/floor/roof. But i want the player only to jump again if location is on the floor.

My collision detection is calc length to triangle and push the player out the amount it is to close from sphere radius.

Any ideas?
Advertisement
A simple solution is to check the surface normal and let the char only jump it is almost pointing up.


if( dot(surface_normal, up_vector)>threshold)
jump;

<=>

// assumption: y pointing up
if( surface_normal.y>threshold)
jump;
I thought of that solutuin, but my floor can rotate,yaw,pitch. Will this work if the floor have a 20 degrees of bank?

This topic is closed to new replies.

Advertisement