- Home /
This question was
closed Dec 05, 2013 at 01:52 AM by
clunk47 for the following reason:
The question is answered, right answer was accepted
Question by
timcommandeur · Aug 24, 2013 at 01:25 PM ·
collisionmeshboxcollidermeshfilter
boxcollider fixed bounds
Hey all,
I have a boxcollider with the extents set to that of the meshfilter.
collider = (BoxCollider)gameObject.GetComponent(typeof(BoxCollider));
SkinnedMeshRenderer mr = GetComponentInChildren(typeof(SkinnedMeshRenderer)) as SkinnedMeshRenderer;
if (mr != null)
{
collider.extents = mr.bounds.extents;
}
When the gameObject rotates, the box scales up to keep the object inside, but I don't want this. I want the boxcollider to have the initial mesh fit and then have it never rescale when the mesh changes it's transform. Does anyone know how to do this?
Comment
Best Answer
Answer by clunk47 · Aug 24, 2013 at 03:49 PM
Try creating an empty GameObject, make it the parent of your object, then just rotate the new Parent (The Empty GameObject).