x


Unity creating static colliders

I have a camera with a few colliders attached to it that flies around throughout the scene. It's a little jumpy, and when investigating it in the profiler, I found it was doing static collider moves. My object contains box colliders (none static), but no rigidbodies. Somehow Unity is considering this a static collider move and grinding my performance. Is there any way around this?

Please see the related forum post: http://forum.unity3d.com/threads/75560-Unity-is-creating-static-colliders-on-load.

In the above post, there was mention of removing rigidbodies from child objects to work around this issue, but since I don't have rigidbodies, I cannot follow this advice. I DID try adding a kinematic rigidbody to the camera, which did fix the problem, but slowed my game down to a crawl.

Does anyone have any suggestions? I need to get this fixed asap!

more ▼

asked Oct 26 '11 at 04:05 PM

sandworm gravatar image

sandworm
153 18 19 23

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

1 answer: sort voted first

"Static Collder" refers to any collider without a Rigidbody. Since you said that you don't have Rigidbodies, you have static colliders.

Basically, in PhysX, everything which is expected to move needs to have a Rigidbody. If you don't want physics simulation to move the object, just set the kinematic flag in the Rigidbody. Colliders without a Rigidbody are expected to stay in place, and are organized in a big data structure for finding colliders in the world quickly - this data structure needs to be rebuilt when you move the collider, thus the performance hit. Besides, the simulation tends to be more stable when you use kinematic Rigidbodies on colliders you move around.

more ▼

answered Oct 26 '11 at 06:15 PM

jonas echterhoff gravatar image

jonas echterhoff ♦♦
9.8k 7 23 104

Hmm, that sounds reasonable. Last time I added a kinematic rigidbody to the camera however, it slowed my performance quite a bit. Any idea why that might have happened?

Oct 26 '11 at 06:44 PM sandworm

But which type of object needs to have a rigidbody? Anytime you move a transform, or only if it has a collider or perhaps mesh renderer or something like that?

Feb 29 '12 at 04:32 PM maciekish

I have some scene objects that have colliders to detect when they have been shot. They have static colliders because they do not move in any way...but they do get destroyed. Does this mean that they should have rigidbodies as well?

Mar 28 '12 at 12:43 PM numberkruncher
(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:

x1862
x1765
x427
x284
x159

asked: Oct 26 '11 at 04:05 PM

Seen: 3215 times

Last Updated: Mar 28 '12 at 12:43 PM