I'm working on game where user generating mesh in runtime (all the time) so mesh have many vertices and in the same time there is a GameObject - player that need to trigger event when it is in area of this generated in runtime mesh.
Camera in this game is 3D, but this generated mesh is flat. In my attached drawing I show this in top view to better show how it looks like.
Now I'm updating Mesh Collider every few seconds, but it is very slow after generated mesh have more and more vertices.
I believe that this is very simple method of collision so maybe there is any other method to detect this instead of Mesh Collider attached to dynamically generated mesh?
UPDATE #1
I know that Mesh Collider is very slow and should not be updated in runtime. I also know the idea that should use primitives like box collider.
But in this situation when this flat mesh in updated every second (and it grow) it will be thousands of box colliders and new need to be added every second. This method will also not work.
UPDATE #2
My second idea is to find nearest triangles to player and create colliders for them (box colliders should be fastest). But I really have no idea where to start or it is even possible ? Someone ?
LineRenderer
's to achieve such an effect? – HristoGameObject
/Player is touching the line or has touched the line – Hristo