- Home /
rotating/moving colliders with or without rigidbodies?
Hi
Im making a Cog that has to rotate.
Empty GameObject with these children: - 1 spehere+collider - 3 boxes with colliders
Im losing 10 fps on iPhone when I have 2 of these rotation in update. I also tried adding rigidbodies but performance didn't come back to max.
Any suggestions or how can I rotate objects with colliders?
//// Code ////
private var thisTransform : Transform; var zRotate : float = 1;
function Awake () { thisTransform = transform; }
function Update () {
thisTransform.Rotate(0,0,zRotate);
}
Answer by jonas-echterhoff · Dec 14, 2010 at 09:15 AM
As a general rule, If you have GameObjects with colliders, and you intend to move them, always add a kinematic Rigidbody. Colliders without Rigidbodies will go into an accelerated AABB Tree in PhysX for fast collision lookups, but this tree has to be rebuilt every time a collider is moved, which will kill your frame rate.
but should I add Rigidbody to each child object which has a Collider or only to the mother (Empty gameobject) ? Or both?
Either will work. If all the only the parent object will ever be moved or rotated, it is advisable to only have the rigidbody on that one, there should be no need to have one for each child in that case.
Answer by kunddizzle · Dec 14, 2010 at 01:06 PM
but should I add a Rigidbody to each child object (with colliders) or only to the mother (Empty gameobject) ? Or both?