Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/368.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 测试旋转_Javascript_Rotation_Collision_Image Rotation_Hittest - Fatal编程技术网

Javascript 测试旋转

Javascript 测试旋转,javascript,rotation,collision,image-rotation,hittest,Javascript,Rotation,Collision,Image Rotation,Hittest,大家好,我的社区 我试图在有旋转物体的情况下让碰撞测试正常工作,但我很难正确检测碰撞 我目前工作的例子: 当物体旋转时,hittest不工作,仅在原始位置撞击平台。我如何解决这个问题 我尝试使用的hittest代码是: if(aX1>bX1 && aX1<bX2 && aY1>bY1 && aY1<bY3) hit = true; else if(aX2>=bX1 && aX2<=bX2 &

大家好,我的社区

我试图在有旋转物体的情况下让碰撞测试正常工作,但我很难正确检测碰撞

我目前工作的例子:

当物体旋转时,hittest不工作,仅在原始位置撞击平台。我如何解决这个问题

我尝试使用的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;
if(aX1>bX1&&aX1bY1&&aY1=bX1&&aX2=bY1&&aY2=bX1&&aX3=bY1&&aY3=bX1&&aX4=bY1&&aY4=aX1&&bX1=aY1&&bY1=aX1&&bX2=aY1&&bY2=aX1&&bX3=aY1&&bY3=aX1&&bX4=aY1&&bY4)