Javascript Hittest旋转

时间:2015-04-13 08:30:29

标签: javascript rotation collision image-rotation hittest

您好stackoverflow社区,

我正在尝试使用旋转物体进行最热门的测试,但是我很难正确地检测到碰撞。

我当前工作的示例:https://jsfiddle.net/studentlearning110/c2quhdad/21/

当物体旋转时,hittest不起作用,只能在原始位置撞击平台。我该如何解决这个问题?

我尝试使用的最热门代码是:

if(aX1>bX1 && aX1<bX2 && aY1>bY1 && aY1<bY3) hit = true;
else if(aX2>=bX1 && aX2<=bX2 && aY2>=bY1 && aY2<=bY3) hit = true;
else if(aX3>=bX1 && aX3<=bX2 && aY3>=bY1 && aY3<=bY3) hit = true;
else if(aX4>=bX1 && aX4<=bX2 && aY4>=bY1 && aY4<=bY3) hit = true;
else if(bX1>=aX1 && bX1<=aX2 && bY1>=aY1 && bY1<=aY3) hit = true;
else if(bX2>=aX1 && bX2<=aX2 && bY2>=aY1 && bY2<=aY3) hit = true;
else if(bX3>=aX1 && bX3<=aX2 && bY3>=aY1 && bY3<=aY3) hit = true;
else if(bX4>=aX1 && bX4<=aX2 && bY4>=aY1 && bY4<=aY3) hit = true;

非常感谢

0 个答案:

没有答案