Collision Redux

Thanks to the NPC’s wanting to vapourise each others hull (and mine!) it was a perfect time to revisit and improve the collision detection from back along…

For ‘something to hull’ collision, there’s no choice but to hit the triangle mesh for the actual model, but given the large number of triangles, it’s not really fun for the player if the game halts for a second or so every time they fire a bullet at a passing ship.

There are going to be lots of bullets flying around, not to mention missiles, debris, laser beams, and other more exotic things 😉 So to that end we have to strategise how we do collision checks, and do as little as possible every frame.

First we do ‘Broad Phase’ which is basically checking the position of something against the bounding volume box of an object. No orientation is taken into account, we just do a quick axis comparison against X, Y & Z. Is the object inside the Axis Aligned Bounding Box or not?

If it is, then we check the ‘something’ against the Oriented Bounding Box of the object, if it’s inside that, then we hit the objects own Octree which contains all the objects mesh triangles.

This then allows the ‘something’ to be collision tested against a very small group of triangles, and only the one’s relevant to the collision taking place (if any).

That gives us the point of impact, the impact normal (surface normal) and the reflection vector incase the ‘something’ needs to bounce off, like a mass pellet, piece of debris or laser beam perhaps.

The previous system is largely untouched, however numerous  bug fixes and performance improvements have been made to improve the turnover of checks and also increase the variety of queries that can be made between objects, as well as better communication of the check vs result vs resolution – before they were all intertwined with each other, but now they are queued and processed by individual passes, allowing for better distribution of the collision data within the game engine itself.

I’m hoping this is all ‘done’ now, bar bug fixing, and it’s working a treat at the moment.

The ‘distribution’ I mentioned above means that all these impacts can now spawn special effects, damage decals can be applied to the vessel, and they can be reflected in the HUD, where you can see impacts on your shields, and your hull, and the same on your target so you can easily see how good a shot you / they are, and how much damage you are taking / giving 🙂

 

SHARE THIS POST

  • Facebook
  • Twitter
  • Myspace
  • Google Buzz
  • Reddit
  • Stumnleupon
  • Delicious
  • Digg
  • Technorati
Author: Mak View all posts by

Comments are closed.

Subscribe to The Dominium Observer Newsletter!
Subscribe