# too much collision check

This topic is 2900 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi. I'm working on a 3D space shooter game with opengl. I've working collision checks but problem is there are too much of them so game slows down. Currently there are asteroids in the space and they have bounding spheres. Also spaceship has a bounding sphere so i check collision with all of asteroids. Also spaceship can shoot bullets and i check every bullet with every asteroid. I use point-sphere collision check for bullets. I remove bullets if they traveled some distance so it is not that bullet count it increasing always. So how can i decrease collision checks to get better fps? Thanks.

##### Share on other sites
You could divide the space into a grid and put each object to a grid cell and only check objects in nearby cells.

Or you can use some more complex space partitioning thingie but i dont think you need one.

##### Share on other sites
Thanks for fast reply. I'll try dividing space and tell you about results.

##### Share on other sites
I've other things to do so I just finished coding and it works fine. So thanks Waterlimon.
And thanks Adam Yaxley i'll check that tutorial.

##### Share on other sites
Or look into bounding volume hiearcies.. Theres a good chapter on them in the Real Time Collision book by Christer Ericsson..

##### Share on other sites
Or look into bounding volume hiearcies[/quote] How does that help, he already is only using spheres as his primitive.

One thing you might be doing wrong is that if you have say the asteroids:
A,B,C
so i check collision with all of asteroids[/quote]
Then make sure you only test:
A vs B
A vs C
B vs C

and not:
A vs B
A vs C
B vs A
B vs C etc

##### Share on other sites
Hold on, here. How many asteroids and bullets are we talking about? Let's make sure we have a good idea what the real problem is before we try to solve it

##### Share on other sites

Or look into bounding volume hiearcies
How does that help, he already is only using spheres as his primitive.[/quote]
He says he's using bounding spheres, not that he's using a BVH. It sounds like he's doing sphere-sphere collision tests for everything, rather than a hierarchy that allows him to cull some of those tests.

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 16
• 9
• 15
• 9
• 11