Physic does not calculate collision on TerrainPage edges


as you can see in the pictures below the wheel of the car can fall through the terrain. This only happens at the edges of a triangle. Is there a way to prevent this?

The terrain generation is a modified version of TestIsland. The problem is really annoying because the car starts to bump heavily if you drive faster. 

Have you turned on physics debugging to verify that collision geometry was generated around the edges?

Also, it is known that ODE sometimes has issues with trimesh-trimesh collisions. So if you are using trimesh collision geometries for your wheels, instead of primitives, that could be the cause as well. You can read more about that over at the ODE website.

The Wheels are made of spheres with a simple model attached to. The terrain has generatePhysicsGeometry(true).

I forgot that trimesh collision geometry is not rendered in debug mode, bummer. So you are rolling along and then you just fall in? Is it only a wheel that falls in or the whole vehicle? I remember hearing about generatePhysicsGeometry(true) being a little picky sometimes, I'm still leaning towards the collision mesh is not complete.

To create the picture I moved the vehicle very slowly to an edge. Normally only one wheel fall in. I'm not able to get the chassi under the terrain. The problem seems to be between the sphere (wheel) and the terrain edges. If the car is driving faster and the wheel gets in the terrain the car starts bumping or the car spins over. If triangles are smaller the problem gets even worse.

It might be the maximum contact count per geom, which is causing the problems (not sure though). But it is quite high by default (200). You can try to increase that (look in OdePhysicsSpace, a call to setMaxContactGeomsPerNearcallback).

Another thing could be improper winding or normals - double check those.

Could you provide an code example as I can't find the method.

There is no example I could give. You would need to modify OdePhysicsSpace code (search for setMaxContactGeomsPerNearcallback in that file).

Ok i will change the value and recompile JMEPhysics. By the way why is there no getter and setter for it?

Because it usually should not be necessary to change it. otoh usually things should not fall through the terrain :stuck_out_tongue:

Probably you should double check winding and normals first.