System Proposal – 3D Collisions
The collision system will be usable as a pointer reference inside the game object. Meaning that the game object will have a “collision object” attached to it. I might have to create a base class for my game object to hide some of the variables if not needed.
Since the engine already has a physics system implemented, I plan on using that as a base to build upon, meaning that the update function called for updating physics will also be responsible for handling collisions.
As I envision it right now, the collision system will have two separate phases, a trigger or collision detection phase which will just detect collisions and call a function which the game play programmer would then be able to override to add whatever functionality is required. The other phase will involve collision resolutions also, such that if two objects collide their collisions will be resolved based on the forces acting on them.
This allows me to split up the project into two parts at the very least so that in case I am unable to achieve all of my goals, I can fall back to just collision detection.
The first phase of this project involves deciding what kind of collision system I will use. As it stands right now, and based on time considerations, I am split between using either sphere-based collisions or AA-BB’s (Axis aligned bounding boxes).
As I’ve seen in most real-world scenario’s physics objects usually have two layers of collisions. A simple (hence cheap) collision detection algorithm first approximates whether two objects collide. If this test succeeds, then the two colliding objects are subjected to a more complex collision test to see if they do. If I can manage to successfully implement the simple collision test within an acceptable time frame, there is a good chance I might add a second, more complex, collision test.
The other consideration I must keep in mind is how the game loop actually checks for collisions. The simplest thing to do would be to check every physics object against every other one in the game. But there are surely better ways to do this which I’ll have to investigate.
As it stands, this project seems a bit ambitious for the allotted time frame.
But it makes me excited, even if to fail.