【发布时间】:2014-02-26 16:49:47
【问题描述】:
不太清楚如何用这个词,但我一直在使用
if (CGRectIntersectsRect(ball.frame, bottom.frame)) {
[self finish ];
}
对于我的碰撞检测,它完美地运行代码,但球有时会与底部碰撞并运行代码,但您可以清楚地看到对象之间存在间隙。我自己创建了图像,它们周围没有背景。我想知道是否有任何其他方式对其进行编码或制作,以便在将 x 数量的像素相交之前它不会运行代码。
【问题讨论】:
-
哎呀——我应该有 Xed Xcode 的时候 Xed iOS。
-
CGRect intersectRect = CGRectIntersection(ball.frame, bottom.frame); if (intersectRect.size.width >= yourMinimum && intersectRect.size.height >= yourMinimum){[self finish];}? -
致 OP:这与 Xcode 无关。
标签: ios objective-c collision-detection