Gravity vs collision

Blitz3D Forums/Blitz3D Beginners Area/Gravity vs collision

Kinkobal(Posted 2006) [#1]
Hey...

In my fps game I want my character to be able to jump around. I've made the necessary code. The player camera has a pivot on the ground dealing with collisions and I deal with gravity using TranslateEntity on the y axis.

Here comes the problem. I can find whether the player should be able to jump by checking if the pivot collides with the ground. However when he is standing on top of an object (a barrel or crate) he is not able to jump.

If I simply check for collisions on objects as well, it screws up. If the player then jumps and steers into the object, the collision with the object will halt the movement in the y axis as well stopping the gravity and thus leaving him hannging in the air...

I really have no clue how to solve this. I'm guessing that I'm dealing with gravity in a wrong way?


GfK(Posted 2006) [#2]
Difficult to say without seeing any code, but I'd hazard a guess that you're using sliding collisions detection - when you're standing on top of an object, the pivot is sliding off the object and hanging somewhere. Try using 'stop collisions' instead.


(tu) sinu(Posted 2006) [#3]
do a check for the y colision normal for each collision, if it's over 0.98(approx) then it should mean he is on a standable angle