Sliding Response after a Point-Square Collision
- by mars
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?