Jump to content

  • Log In with Google      Sign In   
  • Create Account

Sweep AABB Collision/Response


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Psychopathetica   Members   -  Reputation: 186

Like
0Likes
Like

Posted 11 May 2013 - 12:22 AM

Hi, I'm working on a pong style game thats gonna be a blend of Pong and Air Hockey in 2D with some realistic physics. However I ran into a speed bump...collision. Sure everythings all find and dandy using Bounding Box, or even Separation Axis Theorum, but when the puck goes too fast, it'll go through the paddle and not register a collision. I was fully aware at the time that using Sweep collision would be the solution, but I cannot find a decent piece of source code on Google worth using in my game. Now I recently saw this article found here:

 

http://www.gamedev.net/page/resources/_/technical/game-programming/swept-aabb-collision-detection-and-response-r3084

 

Looked very promising, however when I spliced his code into mine, it was awful. The puck slowed down as it got closer to the paddle, and got slower and slower, until it stopped at the paddle. Even when I shut off the physics, and just had the puck move at a constant rate of whatever value I gave vx multiplied by the collision time, it did the same thing. Also theres a limitation in his code, and he did admit there were limitations. It only works if one object is moving and the other is static. However in my game, I have 2 objects moving. The puck as well as what could be the paddle. Maybe if theres an SAT version of sweep collision and response out there. If anyone has any bright ideas on how I can successfully pull this off or knows of any other articles / links, I would appreciate it. Thanks in advance.



Sponsor:

#2 c-up   Members   -  Reputation: 324

Like
0Likes
Like

Posted 11 May 2013 - 01:47 PM

It's a pretty low brow solution but if you only have 3 moving bodies (a puck and 2 paddles) then you could just run the physics with very small time steps.



#3 stu_pidd_cow   Crossbones+   -  Reputation: 1975

Like
0Likes
Like

Posted 11 May 2013 - 03:04 PM

Since you say the the puck is going through the paddle, you should probably make the puck the moving object, and make the paddle the static object (even though it is technically moving). This should have much better results.

 

The results you are getting now makes it sound like you haven't implemented it properly (maybe the broadphase or response is causing problems). Any chance you could supply  some code to show what you're doing?






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS