- Home /
Make mesh collider constantly change
OK, I have a model that has a mesh collider but the problem is that when I do an animation on the object the mesh collider doesn't change, so I will like to know how to constantly change the mesh collider so the mesh collider is the same as the mesh
Answer by Peter G · Mar 09, 2011 at 03:24 AM
You don't. The performance hit from constantly changing the vertex data in a mesh collider is such that it is never a good idea.
Unity will let you change the mesh used as the collider, but the mesh will not be deformed by animations. It wouldn't be a good idea anyway since you would have to recalculate all sorts of things in Physx for collisions.
Instead use a collection of primitives so that is encapsulates your entire object. Very similar to a ragdoll minus the rigidbodies and joints.
Since there's no access to animated skinned mesh data from the GPU, indeed animating a mesh collider is impossible. (You can manually update a mesh collider from a non-skinned mesh where you change the vertices yourself, but it's extremely slow.)
Good idea, but my game is getting complex and lets I don't want to use what is simple. To have an idea, in my model is necessary to use mesh collider because I want to make it more to real life, that means, if I use a capsule it would not be exactly the same, so in this case I prefer to use meshcollider and make it move with the mesh even if is very slow
Well, since Eric confirmed my initial thoughts, you can't. :(
@Uriel: you don't use a capsule, you use a collection of primitives like Peter G said. Updating a mesh collider in real time is too slow to be usable even if it was possible.
O$$anonymous$$ thanks both Peter and Eric for the clarification and answer, I think I will need to find another substitute of collider
Your answer
Follow this Question
Related Questions
Workaround to Non-Convex mesh colliders with non-Kinematic RigidBodies? 1 Answer
Problem with collision detection in an animated object 1 Answer
Cinema 4D mesh collider only generates mesh on exterior of object 0 Answers
Colliders on this spider 1 Answer
I can stand on top of my cave model but fall through upon enter 1 Answer