Sliding Response after a Point-Square Collision

Posted by mars on Stack Overflow See other posts from Stack Overflow or by mars
Published on 2010-03-19T10:22:14Z Indexed on 2010/03/20 1:21 UTC
Read the original article Hit count: 267

In general terms and pseudo-code, what would be the best way to have a collision response of sliding along a wall if the wall is actually just a part of an entire square that a point is colliding into? The collision test method used is a test to see if the point lies in the square.

Should I divide the square into four lines and just calculate the shortest distance to the line and then move the point back that distance?If so, then how can I determine which edge of the square the point is closest to after collision?

© Stack Overflow or respective owner

Related posts about collision-detection

Related posts about game-physics