x


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);

}

more ▼

asked Dec 14 '10 at 09:08 AM

kunddizzle gravatar image

kunddizzle
35 4 4 10

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

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.

more ▼

answered Dec 14 '10 at 09:15 AM

jonas echterhoff gravatar image

jonas echterhoff ♦♦
9.8k 7 23 104

but should I add Rigidbody to each child object which has a Collider or only to the mother (Empty gameobject) ? Or both?

Dec 14 '10 at 10:14 AM kunddizzle

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.

Dec 14 '10 at 01:38 PM jonas echterhoff ♦♦
(comments are locked)
10|3000 characters needed characters left

but should I add a Rigidbody to each child object (with colliders) or only to the mother (Empty gameobject) ? Or both?

more ▼

answered Dec 14 '10 at 01:06 PM

kunddizzle gravatar image

kunddizzle
35 4 4 10

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1999
x1788
x1692
x206
x55

asked: Dec 14 '10 at 09:08 AM

Seen: 1687 times

Last Updated: Dec 14 '10 at 09:08 AM