Terrain collider is inaccurate

I have a terrain with a terrain collider and when I walked around on it I noticed that the collisions seemed inaccurate but almost correct, so I looked at the collision geometry with the physics debugger and found this (collision geometry is in green):

alt text

As you can see, it’s mostly correct but very inaccurate in many places on slopes. Is something wrong or is there a setting to control this? What’s weird is that it looks like the collision geometry has faces that can perfectly match the rendered geometry, it just doesn’t. This kind of accuracy is definitely unacceptable as characters clip into and float above slopes.

To be clear, this is definitely not z-fighting in the physics debugger’s display as I found this by my character floating and clipping through terrain hills. It’s hard to show in a screenshot, but if you zoom in you can see clear differences between the rendered gray faces and the collider’s green faces. [151175-terraintest.zip|151175] and I’m surprised no one else is seeing this as it’s incredibly simple to reproduce. In this project I just have a terrain with hills, a character controller with a simple movement/camera script, and a couple pins in the land that show obvious points of floating or clipping. You can also look at the areas of these pins with the physics debugger and see it is because of the difference between the terrain collider’s faces and the rendered faces. I made this from scratch in a few minutes using only built-in Unity assets and I’m using Unity 2019.3.0f3. It’s also here.

This looks like z-fighting, which would just be a rendering issue. The height difference looks too small to affect your rigidbodies in a meaningful way. To get more help please provide a picture of a character clipping or floating, as well as the movement script.

Unity uses PhysX for 3D physics.PhysX has different collider types and Unity’s colliders pretty much map one to one to the physX types. The Terrain collider is not a mesh collider but a height field. The height field has some features we can not control with Unity, like the tesselation flags for example. Though like ceandros said I don’t see any issue in your image beside the possible z-fighting. So it’s not really clear what your question or concrete issue is.

Technically you may be able to solve this using a custom terrain shader. If the size of the quads can be determined, the triangle vertices and UV’s could be flipped. Not exactly trivial though.