Questions about collision detection
Members - Reputation: 108
Posted 15 March 2012 - 04:58 PM
Members - Reputation: 126
Posted 15 March 2012 - 06:12 PM
There are a number of books on the topic. There are also Open Source libraries to learn from, such as Bullet.
If you're looking to use physics without digging into the details and writing it all from scratch yourself, you are far better off using an existing physics library. Bullet is quite serviceable. There are others. If the game is a free/hobby project, I believe you can even use Havok or PhysX freely.
Crossbones+ - Reputation: 3049
Posted 16 March 2012 - 01:48 AM
It is the correct way to do it. Well, it was.
Is this somewhat the correct way to do this?
It is no more considered sufficient those days and a lot, a lot of things can go wrong. Trying to make my physics subsystem (back when physics engines were new) is possibly the 2nd major error I did. The 1st is spending too much time on terrain algorithms.
I strongly suggest to find bindings for some ready to go physics library and the language of choice.
Let me elaborate.
I take for granted 'do the event' means something involving to notification and re-positioning.
If they intersect, do the event. For example, if a player object intersected a wall, set the player object's coordinates to the outside coordinates of the wall, therefore making it appear solid.
Here are a few things that could go wrong:
- Quantum tunneling: timestep is too long, collision is missed
- Quantum tunneling (opposite encroaching vector): collision is detected but encroaching is so deep the object is pushed out the wrong side
- Instability: when it comes to floors, the object will continuously "jump" on top.