Jump to content
  • Advertisement
Sign in to follow this  
ekba89

too much collision check

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!