Unity3d: Box collider attached to animated FBX models through scripts at run-time have wrong dimension
- by Heisenbug
I have several scripts attached to static and non static models of my scene.
All models are instantiated at run-time (and must be instantiated at run-time because I'm procedural building the scene).
I'd like to add a BoxCollider or SphereCollider to my FBX models at runtime.
With non animated models it works simply requiring BoxCollider component from the script attached to my GameObject. BoxCollider is created of the right dimension.
Something like:
[RequireComponent(typeof(BoxCollider))]
public class AScript: MonoBehavior
{
}
If I do the same thing with animated models, BoxCollider are created of the wrong dimension.
For example if attach the script above to penelopeFBX model of the standard asset, BoxCollider is created smaller than the mesh itself.
How can I solve this?