Reversing Collision Mesh

Hi.

Im making a procedural collision mesh and I need collision to occur underneath it. I have tried reversing the normal’s on the mesh but it still only receives ray casts on the top surface.

How can I reverse the collision mesh so collisions occur on the opposite faces?

Thanks

I do not know how Raycasting is implemented, but it is quite possible they do not use the mesh normals for this (some meshes may not even have any normals defined). In that case, they probably use the “winding order” of the triangles (i.e. the order in which vertices appear in the triangles[ ] array). If this is the case, reversing the order of all triangles in your mesh instead of flipping the normals would solve this for you.

That’s a possibility I considered but my mesh is actually a procedural river I need collision from below for submerged objects but I need rendering from above.

My only option then is to generate the visual mesh, rewind the tris then save that as the collision mesh?

You could also generate the mesh with the winding order facing down (but keep the rest correct for the rendering). You can then use this mesh directly for collision. For the rendering, render it with Cull Front instead of Cull Back in the shader. It should then work correctly for both from a single mesh.

Ah that’s also a nice solution, Ill resolve this one way or the other thanks :slight_smile: