Gravity

Blitz3D Forums/Blitz3D Beginners Area/Gravity

xtremegamr(Posted 2007) [#1]
I'm making a first person shooter, and I'm running into problems with gravity. I keep falling through the floor, and I'm getting very frustrated. Can anyone tell me how to put gravity in my games?


Matty(Posted 2007) [#2]
Have you set up collisions?

If so does it occur when the player is far from the origin (global position 0,0,0)


xtremegamr(Posted 2007) [#3]
Well, I usually set it up as a first person shooter. I load the gun model, create a sphere, and create a camera. I set them all to a pivot. Then, I position the gun in front of the camera, and I set the sphere below the pivot. Afterwards, I set up Sphere-to-Polygon collision detection with the sphere and plane with Collisions(), setting the response to stop. But I keep falling through the floor, no matter if I position the pivot at the origin or far away from it.


Dreamora(Posted 2007) [#4]
3 Possibilities:

1. You didn't set the entityradius correctly (use for the sphere collision)

2. Your gravitiy is to high, the object just teleports through the ground

3. You might have renderworld but forgot to call updateworld, which is needed for this.


chwaga(Posted 2007) [#5]
you need to set up a sliding collision and say "if not countcollisions (object) then translateentity object, 0, -.1, 0" That's what I did with my game (not FPS though, shouldn't make a diff however


xtremegamr(Posted 2007) [#6]
Okay, I'm still having problems. I've tested out everything you guys said, and it still doesn't work.

But I've found the problem. The feet aren't moving with the player pivot. But...I'm looking at the code right now that creates the feet and assigns it to the player pivot.