- Home /
Box Collider not moving with animation
Hi there, hope this question hasn't been asked before already (had a look and I couldn't find anything).
Basically I have a door modeled in maya with an opening animation attached, I exported this to unity as a fbx with an heirachy of the door and the handles which are also animated.
I'm using a box collider on the door then through raycast and tags to trigger the animation.
Everything seems to work but unfortunately for some reason the box collider doesn't move with the animation so even the door is open I can't walk through to the other side (I can walk through the door now though, which obviously doesn't help).
I think I'm probably missing out something obvious but can't seem to fix this, any help would be appreciated!
Thanks in advance!
Answer by Atnas1010 · Oct 29, 2010 at 12:15 PM
The animation only moves the mesh being displayed, it does not change the transform of the object, which you have applied the boxcollider to.
If it is only a simple open animation I would definitely suggest not using animations to turn the door, but modifying the rotation directly from script.
If you still want to use the animation, or need to do animation for something that's a bit harder to use scripting for, such as a whole character, you can attach primitive colliders to bones, and they will follow the animation.
Hopes this answers your question
Hi Atnas, thanks for the explaination...I couldn't solve it in the end so I re-animated the door in Unity.
I guess I was trying to figure it out as I was worried I couldn't get my character animations working also down the line. I'll try what you said about attaching primitive colliders to bones though, thanks for the help!
Pretty old question but this "you can attach primitive colliders to bones" is an amazing idea! Would have never thought of it myself.
Your answer
![](https://koobas.hobune.stream/wayback/20220613081250im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Open Door Via Trigger Collider 0 Answers
Player to Door Collision and Animation 3 Answers
Pause animation door when you block it while opens/closes 2 Answers
How to move BoxCollider with animation? 1 Answer
Animating Colliders? 2 Answers