- Home /
Limiting collision between single objects
I have a list of AI which each move across a map. Each AI has a rigidbody, and has gravity applied to them. The map is composed of a list of "chunks", with each chunk consisting of a single mesh collider. In my code, I already determine the chunk an AI is on top of for pathfinding purposes.
An AI will only collide with a single chunk. I'm assuming Unity's collision detection system would speed up if I told it explicitly which colliders to check for collisions between. Is this possible? If it is, would it actually improve game performance, or should I let Unity handle figuring out collisions on its own? Obviously, the effectiveness of this will depend on the implementation, but I'm looking for general answers.
Also: this is for a game jam which is due in a few days. The game will be run on WebGL, so I'm looking for tangible performance boosts that can be programmed quickly. Thanks for the help!
First, just run a test to see if it would actually help the performance, maybe you are worrying about the wrong thing. But if you are game-jam$$anonymous$$g, I don't think you should be wasting time on such optimizations (unless it's clearly a bottleneck). The physics world is organized for faster potential collision lookup
what Panga$$anonymous$$i says in general.
Check the profiler to find your actual bottleneck instead of being like: "i think this is the issue so i'm gonna spend time on optimizing this"
The easiest way you could have performance gains here is by playing around with this: Broadphase settings in your projects physics settings
Answer by EvilBob99 · Dec 13, 2021 at 03:32 PM
@justingarrigus I have to say the colliders won't be affecting your games performance because it won't be running collision checks further than where the ai's at it's something else in your game giving you lower fps I hope this helps sorry this isn't exactly what your looking for