# Edges Convex Polygon

## Recommended Posts

Hello, i have read lots of tutorials on the internet, but i can´t find a good one that i fully understand. I am doing a FPS game and i am having a real hard time with the Collision Detection. I am only using 2D, just lines or polygons as bounderies. don´t even use planes, so the game is like Doom just 2D. I user a Sphere against any polygon wall or just linesegments and can easily determine how for away the sphere is by projecting. i can also use raycast and see where the view vector intersects. Corners are no problems, just count nr of hits, when 2 you are in a corner. (check angle and so on) The MAIN problem is edges, convex edges, i need to check that the sphere is free from BOTH walls of the edge before sending the spehere sliding at any direction. I have also tried the closest point on the polygon but the problem with edges also appears there. its hard when using normal length to setup a max_distance from wall, on the edges there becomes "hole" in the middle of the convex edges. I don´t need links to tutorials, ihave seen them all (i think =)) i Need a Plan, how do you solve sliding a sphere around an edge in 2d? need help.

##### Share on other sites

Let's say you have a wall corner. And you are trying to 'slide' a circle around the corner.

Let's say that you do a good job of keeping the Circle vertexes out of the wall, but the corner of the wall slides into the circle between two of the Circle Vertexes.

##### Share on other sites
Yes! exactly! If you have any solution i will be very happy to hear about it =)

##### Share on other sites
Problem solved, once and for all!

User closest point on polygon. follow the point if user if facing walls. thats it! peace of cake! =)

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
628290
• Total Posts
2981856

• 11
• 10
• 10
• 11
• 17