- Home /
Collider not working with dynamic mesh
Hi, I'm developing an Interactive Display software with Unity. I grab a 160*120px texture of the user(s) from a depth sensor through ZigFu Unity Plugin (wich uses OpenNI). Then I use some funcions provided by 2DColliderGen plugin to obtain a Mesh collider with the shape of the user (or part of his body). I do this 15 times per second, and in the Unity Scene window I see the mesh correctly. The problem is that I am unable to make this mesh collide with other objects. In the picture you can see the generated mesh collider. Neither OnTriggerEnter() nor OnCollisionEnter() are called. The cube has a rigidbody, gravity enabled and kinematic disabled.
I think I have identified the problem. The user mesh collider does not become in contact with the cube because it moves, but because, changing its shape, at a certain point it overlaps or intersects the cube itself.
There is a way to know if a mesh intersects another one without the use of a collider?
Thank you
You have a rigidbody attached to the object with the collider?
Yes, the cube has a rigidbody, gravity enabled and kinematic disabled.
And on the cube is the thing with the detection script on it right? The body will also need a rigidbody because it is moving and the physics system needs to know it is changing.
Yes, the cube as a script with both OnTriggerEnter() and OnCollisionEnter(). The body has a rigidbody with "use gravity" disabled an "is kinematic" enabled.
Ok so mesh colliders can have problems with back face culling etc - need to have a limited number of vertices etc. Have you tried using just an ordinary mesh on the mesh collider to see if that works? - If not then perhaps starting with something simple like a cube (as a mesh collider)?