Box "sucked" through terrain ground; video example!

Hey guys,

I’m working on a physics bug in 3089… whenever a box gets rolling on a hill, it will often just get “sucked” through the ground. It isn’t just falling through, it picks up amazing speed to pop through the other side underground. Here is an example video:

[video]http://www.youtube.com/watch?v=ltSdp0qif_k[/video]

I’ve set the grounds margin to 0.075 (and even all the way up to 1), and although it causes the box to “float” a bit above the terrain, it still falls through at certain rolling speeds and angles like in the video. The default margin of 0 also causes the problem.

The box is a simple BoxCollisionShape and the ground is a MeshCollisionShape, using the official release native 2.82 Bullet build (current in SVN). The friction on the box is 3. Setting it to 0.5 or lower makes it slide around and roll less, which seems to make it want to get sucked through the ground slightly less, but it still happens…

Anyone see this before and/or have any suggestions? Thank you!

ive had this problem when the ground triangle is much much larger than the object sitting on it. you seem to be having a different issue though as your ground looks to be made up of several fair sized triangles.

1 Like

have you treid using ccd? it makes a ray(sweep) test before moving the box to prevent certain tunneling effects.

Also what are the scales of the box? bullet is bad at very small and large numbers.

The scale of the box is around 1f…

How do I use “ccd”? Don’t think I’ve tried it…

I got this kind of effect (i.e. falling at a super speed, higher than the gravity) when i used the charactercontrol, and it came from the stepheight thing. When you are walking downstairs (on a stairs i mean), the charactercontrol just go down very very fast to avoid the “fying” effect you should have (cause in most fps you have a very high move speed).

I don’t think you are using a charactercontrol on your box however.

I’m not using a character control… just a box rolling after being pushed or dropped by gravity. Seems to happen near mesh edges / vertices, like rolling from one physics face to two or more…

EDIT: Found “ccdThreshold” functions, playing with them now…

setCcdThreshold(0.001f) or setCcdThreshold(0.01f) doesn’t help :frowning:

Thank you for the suggestion… box still gets sucked through the ground. This is a pretty nasty bug…

Reply 1 probably has the answer. If you say “roll from one face” that would imply that you in fact have a mesh with single faces larger than the box. Your options are subdividing the collision mesh or trying if a hull shape instead of the box works better. Or using a heightmap shape for the ground but idk if thats possible in your case.

So, I think the problem is with the box shapes… so, screw boxes! I give you, frankenphysicsbox:

Bwahahaha! It is now a CompoundShape with a few spheres to make a box-like shape. I’m going to try this with some capsules or cylinders, see if that works at all… but, so far, no sucking through terrain! :smiley:

well, i just “lolled”. i guess the ultimate rule of game simulation is that if it works, it works :smiley:

@phr00t said: So, I think the problem is with the box shapes... so, screw boxes! I give you, frankenphysicsbox:

Bwahahaha! It is now a CompoundShape with a few spheres to make a box-like shape. I’m going to try this with some capsules or cylinders, see if that works at all… but, so far, no sucking through terrain! :smiley:

If it works noone will probably care ^^

What happens with a hullcolision shape and 8 vertice? This is more closer to the real box, but uses a more generic algorithm and not the box one.

Hull/MeshCollisionShape has the same problem… :frowning: I’m trying with ColumnShapes now… 3 of them, if they don’t get sucked in, should work pretty decently…

CylinderCollisionShapes DON’T work :frowning: I think it has to do with sharp edges on a large triangle physics mesh… guess my sphere frankenphysicsbox will be “the” solution. CapsuleCollisionShapes do not work either. Spheres FTW (as in, “for the workaround”)!

What might work is enabling ccd even for slow moving objects. At least it should fix any kind of tunneling bahaviour. (assuming that ray results are correct on that terrain)

@Empire Phoenix said: What might work is enabling ccd even for slow moving objects. At least it should fix any kind of tunneling bahaviour. (assuming that ray results are correct on that terrain)

I tried setCcdThreshold(0.001f), which I presume was setting ccd for something slow moving (0.001f, low threshold), but I still had the problem.

Hm then I’m out of ideas :confused:

Only thing you could test, (in a simle testcase)
if different triangle sizes do help. Eg devide each trinagle into two subtriangles.

Also the heightmapcollision shape might be worth a try, if you terrain is compatible with it.