- Home /
Mesh Collider Does not rotate with Mesh
The Mesh collider I assigned does not rotate with the mesh during animation.
Here is a picture before animation has been played showing the collider is placed properly.
As shown in the picture, the mesh collider is assigned to the deltoid, which is a child of a larger game object (YogaCharacter). From what I have researched Online this may pose a problem since the mesh's transform and rotation is based on its parent, which at least in my case causes a problem with the collider. I have tried replacing with a box collider to test if a simpler collider would rotate, but no cigar. How can I fix this problem?
EDIT: I imported the mesh and the animation from Maya. I feel like that must be part of the problem. If I create a sphere in unity, create an animation for that sphere. and make the sphere a child of a gameobject everything works fine!
Pretty sure you need to modify the transform in order to modify the collider. I am not sure if animations will do what you are looking for.
Answer by birns92 · Apr 26, 2016 at 03:52 AM
I figured out a simple solution to get it to work. I moved the mesh to be a child of it's counterpart in the character Rig.
I realized that if it is a child of the Rig, the mesh Collider will inherit the Rotation of the Rig Animation. This is a very tedious process since I have hundreds of bones and muscle objects. Does Anyone know a faster route?
Answer by UDN_30011711-3d42-4608-a55a-5bf3a3109e16 · Feb 02, 2017 at 08:13 AM
Add colliders on joints. It worked for me. Definitely not mesh colliders , you can use box , capsule or any other collider that is appropriate .
I agree. It's seems easy to me to just create child objects to each bone with sphere colliders which only take 1 line of code (1 call) ins$$anonymous$$d of a box collider with 4 if statements (4 calls). If I do them directly on each bone, I can't position them perfectly, so with empty child objects I can position each bone allowing me to move the positions around without affecting the bone positions.