2旋转立方体之间的碰撞检测 [英] Collision detection between 2 rotated cubes

查看:278
本文介绍了2旋转立方体之间的碰撞检测的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
  <一href="http://stackoverflow.com/questions/3648285/collision-detection-between-two-general-hexahedrons">Collision两个基本六面体的检测

现在我做的碰撞检测通过寻找最大和最小值,做边框检查。不幸的是,我的播放器立方体旋转与相机并且这使得对于一些恼人的结果时,播放器是在一个45度角。约束条件是,每个立方体是轴神韵,具有8 verticies,但玩家人们可能会旋转(基本上我做的正弦,余弦,每个顶点和绕立方体的中心。鉴于此,我该怎么办精确的碰撞检测,因为我的球员旋转?

Right now I do collision detection by finding the min and max and doing bounding box check. Unfortunately, my player cube rotates with the camera and this makes for some annoying results when the player is at a 45 degree angle. The constraints are that each cube is axis alligned and has 8 verticies, but the player one might be rotated (basically I do sin, cos, to each vertex and rotate about the cube's center. Given this, how can I do accurate collision detection since my player is rotated?

感谢

推荐答案

如果没有旋转的立方体之一,那么它很容易检查,如果一个点是立方体内(含边界检查)。因此,采取的每一个旋转立方体的8个节点,并检查,看它是否属于未旋转的立方体中。

If one of the cubes is not rotated then its easy to check if a single point is within the cube (with bounds checks). So take each of the 8-nodes of the rotated cube and check to see if it falls within the unrotated cube.

这篇关于2旋转立方体之间的碰撞检测的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆