Optimize the collision detection

Posts: 6
Joined: 2012.11
Post: #1
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
Quote this message in a reply
⌘-R in Chief
Posts: 1,277
Joined: 2002.05
Post: #2
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
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Collision detection tutorial ThemsAllTook 7 27,706 Nov 5, 2011 05:20 PM
Last Post: SethWillits
  Help with Collision Detection..(i'm almost there) carmine 1 6,670 Jun 29, 2011 12:33 PM
Last Post: ThemsAllTook
  Time Delta, collision detection mk12 19 24,118 Sep 8, 2010 06:40 PM
Last Post: AnotherJake
  Collision detection for pinball game johncmurphy 0 6,092 Sep 6, 2009 02:46 PM
Last Post: johncmurphy
  Phases of Collision Detection Ingemar 5 12,236 Aug 24, 2009 06:11 AM
Last Post: Skorche