- Home /
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!
Answer by jonas-echterhoff · Oct 26, 2011 at 06:15 PM
"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.
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?
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?
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?
Your answer
Follow this Question
Related Questions
Add sub object to Rigidbody 1 Answer
Controll squeeze of rigidbody between static collider and kinematic rigidbody. 1 Answer
Get all child not working? 1 Answer
Is the child collider still static even if I parent them with a rigidbody ? 2 Answers
Physics.SphereCastAll to get rigidbody's like OnCollisionEnter 3 Answers