Java2D距离碰撞检测
我当前的设置仅在发生碰撞后才有用;显然一定有比这更好的东西吗?
public boolean CollisionCheck(Rectangle rect1, Rectangle rect2) {
if(rect1.intersects(rect2)) {
return true;
}
return false;
}
如何进行先发制人的碰撞检测?
My current setup is only useful once collision has been made; obviously there has to be something better than this?
public boolean CollisionCheck(Rectangle rect1, Rectangle rect2) {
if(rect1.intersects(rect2)) {
return true;
}
return false;
}
How can I do preemptive collision detection?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一般来说,你会预先计算一步,如下所示:
Inside Rectangle class:
Then,
Ha。特拉维斯比我先进来。很高兴看到 SO 有更新答案通知。
Generally, you pre-compute one step ahead, something like this:
Inside Rectangle class:
Then,
Ha. Travis got in before I did. Nice to see SO has update answer notifications.