A bit of an annoying problem: Basically I do realtime deformation of a mesh based on which triangle was hit with a collision. However, disturbing the triangle with the same index as the one reported by the collision info does not disturb the correct triangle. It is as if there is a difference between how the meshes are built even though it is a basic poly mesh with an attached mesh collider.
Has anyone encountered this before? Any tips to straighten this out?
Many thanks in advance!
OK - found the source of the problem: Static batching.
Of course, as soon as the mesh has been combined it is logical that there is a difference between the collision mesh and the rendered mesh. So I can’t trust the triangle index, or rather it is useless when deforming the rendered mesh.
I would be very thankful for ideas on how to determine the corresponding mesh triangle from the hit info for a combined mesh. The best I can think of currently is to try to (at start) establish the index difference by hitting a known triangle index and then using that for future operations.
Any better ideas…?