falling thru terrain

Nate
Posts: 4
Joined: Sun Jun 10, 2012 7:14 am

falling thru terrain

Post by Nate »

I'm using JMonkeyEngine for a first person shooter where players can fly using a jetpack. I have a problem where a player that is falling rapidly will go through the terrain. Are there configuration settings that would help with that? The length of the linear velocity vector when this occurred was ~140, to give some idea of what I mean by "rapidly". I would like to support players moving at speeds up to ~350 meters/second, though 150 would be a typical fast speed.

I have a few additional problems. Sometimes when a player jumps they are propelled very high, other times they barely move. This seems worse when vsync is off. Sometimes a player seems to get stuck on the terrain, unable to walk until they jet or jump. I realize these problems are probably jME related, but thought I'd mention them here in case anyone has input.

My game is similar to Tribes, where you can walk, jump, jetpack, and ski. Skiing means you go frictionless, so you can slide down hills to build up speed. I don't know if I'm setting the Bullet properties correctly. The physics with these settings are mostly what I want, though the player is a bit too bouncy when skiing. The whole game is currently < 300 lines of code, and very few of those are relevant to Bullet and my problems above. Possibly you guys would be willing to take a peek?
http://pastebin.com/Ud0Nexhz
Line 92 sets a couple physics properties on the terrain.
Line 104 sets a couple physics properties on the player.
Line 182 is the function that computes a vector to apply force to the player for walking, jumping, and flying.

The settings, in case you don't have time to dig through my code:
Accuracy is set to 30hz.
Terrain: restitution=0, friction=0.8
Player when skiing: mass=0.5, restitution=0, angularFactor=1, friction=0
Player when walking: mass=0.5, restitution=0, angularFactor=0, friction=0.9
Also, when changing from skiing to walking, I set the angularVelocity to zero.

Might any of these settings cause issues? Do you recommend any other settings for my desired effect?
Nate
Posts: 4
Joined: Sun Jun 10, 2012 7:14 am

Re: falling thru terrain

Post by Nate »

The only thing that seems to work is setting the fixed time step to 1/500 and max steps to 16. Is this reasonable?
Nate
Posts: 4
Joined: Sun Jun 10, 2012 7:14 am

Re: falling thru terrain

Post by Nate »

Thanks to a PM for a nice forum member, ccdMotionThreshold seems to help. Doesn't make it go away completely, but seems to allow lower Hz.
RoxXx88
Posts: 4
Joined: Sat Jun 09, 2012 10:24 am

Re: falling thru terrain

Post by RoxXx88 »

How have you solved? Plz, I have a similar problem...
Nate
Posts: 4
Joined: Sun Jun 10, 2012 7:14 am

Re: falling thru terrain

Post by Nate »

I set ccdMotionThreshold to 1 and it seemed to help. Other than that, increase the number of steps per second. I posted more here...
http://www.java-gaming.org/topics/duel- ... /view.html