Quantcast
Channel: Question and Answer » libgdx
Viewing all articles
Browse latest Browse all 434

Circle to Polygon collision response

$
0
0

I’m working for collision response for my 2d game. Character is represented by circle and obstacles are represented by Polygons(in my example it would be rotated rectangle for simlification). The problem is when circle collides with vertice of polygon, I know how it must work , but can’t find the vector.
C – the center of the circle.
V – vertice.
P – the center of the polygon.
X – the vector I need to find.
enter image description here
Then I’ll just move my character by vector V.sub(X).
Tried this algorithm, but it gained no result.
http://stackoverflow.com/questions/1073336/circle-line-segment-collision-detection-algorithm


Viewing all articles
Browse latest Browse all 434

Trending Articles