Good physics collision bounds for performance/accuracy

I’ve got asteroids and a space ship. All asteroids are currently rigid body with convex collision bounds. This is the only option I’ve found that prevents players from either flying into part of the asteroid mesh, or colliding just by being near it but not truly connecting.

My problem is that I want to have at least 100 or so asteroids on screen at any given time (It’s part of a dynamic playing field) and with convex hull my physics goes to about 90% and causes fps to drop to 10 or lower. This is with 99 rigid bodies floating in space un-moving and the player colliding with a single asteroid. It just doesn’t seem right, but regardless I have to change something. Any thoughts?

Also, I’d like to post my .blends on occasion if it’s needed, but so far I’ve been unable to do so while keeping textures in tact. How do I do this? (sorry for the double question, but if someone wants the .blend I’d like to be able to provide the entire thing).

One thing to try (and something commonly done in commercial games), is to have the existing asteroid mesh as the visible mesh and a highly simplified version as the collision (or physics) mesh), you would basically parent the collision mesh to the visible mesh and make the collision mesh invisible.

With convex hulls in general, they can be pretty slow when they need to factor in a lot of polygons, another possible solution is to use the compound option (which means the collision mesh is made up of different shapes using the fast, basic bound types).

To keep the textures “in tact”, I assume you mean you want to pack them but keep them in the current directories. Click File -> External Data -> Pack into .blend file in the File menu then save it as another file and exit without saving the blend you want to upload.

Hundreds of complicated objects is quite heavy…

Upload the .blend so we can see what the physics visualization looks like :slight_smile:

EDIT: also try what Ace Dragon said. Simplifying the object bounds will help drastically with the performance.

of course “sphere” is the fastest

So it’s clearly a polygon count issue. I was being distracted and changed the subsurf on my player object and the framerate dropped to 5 fps when I hit the asteroid. I think that Ace Dragon’s idea is going to work fine for me. I’m guessing I would have the asteroid itself be a no collision physics type? What is i’m-not-calculated-at-all setting? Then I’ll just do a basic outline of the object and use that. Sounds good. I’ll give it a try and see how it differs.

Well quick second question then. I’ve noticed already when trying to create a laser (parenting a light to an “emitting” green object since I can’t get any normal light emission in BGE) that the parented object doesn’t “become one” per se with the object. I’ll be reusing this asteroid a lot in different scenes and to create my “asteroid belts” and whatnot. What’s going to be a good way of going about this?

If this test doesn’t help out I’ll post my .blend. Thanks for the answers so far! :smiley:

EDIT: Totally sounds like I’m talking to myself in this post…

Ace Dragon, you’re awesome.

In this test I was using a single rigid body object with 1920 triangles and a player object of 1430. Colliding with convex hull collision bounds spiked physics calculations to the 90%, which dropped FPS to an unplayable/unacceptable rate. Using a separate collision object for the asteroid, consisting of only 44 triangles, dropped this spike to only 33% at the highest, but generally staying at 28%. I am confident that using the same method for my player object will eliminate this spike altogether. I’ll post my results after I do that. :slight_smile: