Ive been working on getting 2D Sliding Collision working lately, and Im almost done. So far Im able to slide along 2D lines using circle collision, but the problem is corner's (both convex and concave) provide some problems.
This post in the code snippets board shows my progress
This picture outlines my basic problem (from
http://www.gamedev.net/reference/articles/article1026.asp)
I understand what needs to be done, just not quite how to do it. Basically the information from the site provided above says that you need to find out which normal is the closest to the collision circle's centre, and then get the sliding position based on the normal's plain (which extends to infinity in both directions of the normal) instead of just the normal.
Im able to get the distance from a point to a line (with the help of phaelex's snippet), but Im not sure how Ill get the closest normal to a point, Id have to cycle through every position on each normal getting their distance to the circle until I found the shortest distance I think, which seems pretty intense.
Other than this my last problem (easier to solve Im pretty sure) is stopping the user from travelling as they enter corners too tight for them to go in, like this:
From reading the information on the sight I provided, it looks like getting the plane information is a pretty difficult process. Im not really looking for code, as I like working out the programming side of things myself, but does anyone have any tips or pointers, or better explanations, of what I need to do here?
Thanks,
- RUC'