iDevGames Forums
Optimize the collision detection - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Programming Fundamentals (/forum-7.html)
+--- Thread: Optimize the collision detection (/thread-10593.html)



Optimize the collision detection - alaslipknot - May 12, 2013 09:01 AM

Hello everyone,
since i've been working with flash (2years ago) and until now with java am always facing this kind of problem, my collision detection method, it works but it's not "precise" at all, specially when it comes to a platformer game when it collide with the ground, depending on the jump am doing, some times a little part of the player get into the ground, i know that this issue is because of the moving speed, the speed of calling the collision detection and the distance between the 2 objects to collide, so for example if the player is far 10 pixels and in that exact moment it had to move 20 pixels and in the same moment the collision isn't called yet, then the player will get into the ground until the collision detection is called
if you still didn't understand my issue you can try the game here
am not sure if you need any codes for this problem since am not also looking for a code solution i just want to know how does things work

thank you


RE: Optimize the collision detection - SethWillits - May 12, 2013 08:02 PM

I'm not exactly sure which part of the problem you're trying to solve, but this is where running your physics at a fixed and very small timestep is useful.

If an object is moving a great distance, collision detection etc can break down. A solution to that is to run your physics much more often which results in that big movement broken down into a bunch of small movements. The advantage is that the detection and response is more accurate.

See: http://www.idevgames.com/articles/timebasedanimation