iDevGames Forums

Full Version: Optimize the collision detection
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
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.

Reference URL's