- Home /
What Space Partitioning is used for Sphere Collider Triggers?
Hey there, I had a question very similar to this, and was wondering, exactly how does Unity implement space partitioning with its physics? I.e. how does it actually check if a collider is in my trigger sphere?
I have a simple cell based partitioning system going in my RTS game, and was wondering if proximity (using dist squared) checks for all characters in my neighborhood would be faster than using Unity's sphere trigger, or vice versa.
Thanks :)
Answer by Owen-Reynolds · Dec 12, 2011 at 01:10 AM
I would imagine Unity's is "better" because you can't turn it off. If you use your own, Unity is most likely still going to maintain an Oct-Tree, or whatever, and take the time to check in and out every collider that moves.
So, UnitySpacePartition + UnityTriggerChecks is almost for sure faster than UnitySpacePartition + yourPartitions + yourChecks. Maybe you could never use colliders, so Unity's system never does any work, and use your own. But then you give up the buultin rayCasts and mouseOvers.
You make a great point. Hmm maybe I should ditch the CBP system I have completely and rely on Unity's space partitioning, eg. to check if an enemy is within aggro range, just check if they are within a trigger sphere.
But still, do you happen to know HOW unity does its partitioning?
Your answer
Follow this Question
Related Questions
Mesh collider trigger 2 Answers
OnTriggerEnter is not running! Need help with collision. 2 Answers
Can't click gameobject when over another trigger? 1 Answer
trigger not triggering 1 Answer
Triggering platform animation on colliding with Button 0 Answers