如何找到旋转和非旋转物体的碰撞检测位置?

How to find position for collision detection with rotated and non rotated objects?

https://editor.p5js.org/bigboss01/sketches/OZLv0TPBn

这张草图说明了我遇到的问题。我想检查箭头和矩形的交点,但是因为箭头是旋转的 space,所以它没有正确地注册交点。

我看过关于分离轴定理的精彩教程:https://dyn4j.org/2010/01/sat/ , but I would appreciate some help connecting the dots as I don't fully understand how to implement this solution. I found this library,但如果有人知道更简单的方法,我将不胜感激,因为这似乎是一个相当基本的问题。

我正在尝试解决的问题 is in this sketch (a lot more code here, skip to this.update() in the rocket object for collision logic) that is from this tutorial by Daniel Shiffman, his version is here,其草图似乎没有同样的问题 - 我的火箭不会卡在栏中,也不会始终记录到达目标.

我刚刚为此做了一个sketch

不知道这是否是最好的方法,但它对我有用。

Dan 也有关于 xSpeed = cos(a) * r 公式的视频,它应该是类似“极坐标到笛卡尔坐标”之类的东西。

此外,当你有 x (x + xSpeed !!!) 时,你可以使用“点-矩形碰撞”,我只是检查 if(y > 300)