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?
Detect the collision point by testing the movement vector against the wall. If you know things about your surface (e.g. as you say it’s part of a box) you might be able to test multiple walls at once.
The solution can be slightly different between 2D and 3D. I’ll go with 2D since you’re talking “square” rather than “cube” or “box”.
Once you know where your point is hitting, you take the remainder of your movement vector, dot it against the wall direction (subtract one point on the wall from another then normalize) then scale the wall direction by that amount. This is the amount of motion that would be parallel to the wall, assuming no friction.
Edit added the following code:
boilerplate:
The real business:
I hope that is useful.