- Home /
Prevent Fallthrough with Procedural Mesh and Collider
I have a plane and I am modifying the mesh for the plane at runtime (using a sin wave) trying to make it look like waves. I also have a mesh collider on the game object and I am setting its mesh every time I change the plane's mesh.
Further I do know about setting the colliders mesh to null before reassigning it. So that isn't a problem. The collider mesh is updating.
Ok so what I am suffering from is that when the mesh and collider get updated, if they move up they might just move right on into the colliders i have on top of the plane. If they do any object that is no longer completely above the collider just falls through.
Obviously this makes good sense, I am modifying the collider and the physics engine cant make collisions happen when its collider just magically changes (from its point of view).
So my question is, What can I do to prevent objects from falling through? Cheap hacks welcome, i am not looking for a lot of realism here just want to keep objects on top of my mesh. (Shooting for ocean waves looking stuff but don't plan on doing boyancy since i think that would be expensive).
if you dont want boyancy could you just ignore the wave mesh altogether an have another invisible mesh that the boat moves on?
I am not sure how that would help, it seems like I would have to deform that mesh as well in order to have the boat move close to the waves. $$anonymous$$aybe I am missing something though, not that good at 3d collider stuff in general :)
Also I am happy to try buoyancy, just worried that it will be too costly, I am not shooting for real looking physics just want to keep the boat afloat. If I were to do buoyancy is there an easy way to tell that the boat is below the surface of the water (since the water is changing)