a way to stop a player from falling trough the ground?

hello blender type people, im currently working on a FPS project, and it involves a city, well if the player jumps off one of the buildings, every once and a while the player will fall through the ground(the ground is a plane) so i was wondering if there is a way to stop or prevent this. im ok with both logic and python soulutions :yes:

Attached to an always sensor you can have a script that repositions the player if its z value is less than a certain value and gives it a zero z velocity at the same time. You might also have a thump sound and an ipo of a crouch movement so you could apply those here also. If you need to position the player accurately you can find its lateral velocities and do a little math to position it back at the point that it fell through. This would all happen in a single frame and so wouldn’t be seen.

I’ve found that using servo motion, rather than simple motion greatly reduces the chance of falling through the ground. Also making the floor a box collision type if using a flat plane or a triangle mesh with smaller triangles if using hills or whatever can help. If the triangles are too big, it is more difficult to avoid falling.

If it is a really big problem you can set up a script to set servo max Z values to 0.0 when a ground collision sensor is acive. You’d need to includ another script to turn the max setting off when jumping, or your character won’t leave the ground.

when you have hills, then just lay another plan under the current one, this other plane should have no hills. then when sonthing goes wrong, you, as mentioned above, calculate the distance from your ground and that plane at that given point, positioning you char on that high. Using an always sensor should be the right way, but it could be a bit intense, to run a check on every frame.

Another way is to, if you can do this, remove any jump/fall actions. this would allow you to make a system that just changes the position of the char to a constant value away from the ground. even then you could fake jumping in animations etc.

greets equal

Yeah, in my game I use a force based on distance to the ground (using a ray) for jumps. That way you never hit the ground with enough force to drop through. You can use an always sensor with a script to give vertical lift and a timer to reduce the lift at the end of the jump. If you set the always sensor to run every 4-6 clicks then it shouldn’t be too much of a drain on resources.