开发者

Collision handling with Rotated Rectangles

I am about to develop a little 2D game. The perspective is top Down like, so you can only see the Had of the player. You can move the Player with WASD and he and his Collision Box Rotates, in the Center of the Player, to the mouse Position. In the World are some rotated Walls, by which the Player can collide with.

I have a function for the Collision detection with 2 rotated Rectangles, but i don't know how 开发者_StackOverflow中文版to handle it.

Has someone a function, with takes the 2 rotated Collision boxes and gives me the right position back. Or has someone an example for such a problem?


The algorithm you want is called the separating axis (or axes) test (this should help you search for it). The paper "Intersection of Convex Objects: The Method of Separating Axes" by David Eberly has a good description. Or see this answer of mine for a short summary.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜