【发布时间】:2019-05-05 09:50:54
【问题描述】:
我有点吃不消了。我正在努力让我在 VR 中从手上释放的对象采用控制器的正确速度和 angularVelocity,以便它们的释放运动感觉自然。这是跟踪控制器角速度和速度并在释放时将其传递给对象的简单问题:
rigid.velocity = controller.currentVelocity;
rigid.angularVelocity = controller.currentAngularVelocity;
然而,踢球者来了,我还有一个运动系统,它恰好使 CameraRig 相对于玩家的头部旋转,并且在这样做之后,这些值都是错误的,并且相对于 cameraRig 发生了移动,如下所示:
cameraRig.transform.RotateAround(headsetCamera.transform.position, Vector3.up, -(headsetCamera.transform.eulerAngles.y - lastHeadRot.y));
lastHeadRot = headsetCamera.transform.eulerAngles;
我曾尝试寻找类似 (ref) 和 (ref) 之类的答案,但都没有奏效。任何建议都将受到欢迎。当使用其他形式的运动时,角速度和速度会正确设置为抛出的物体,但在我使用 cameraRig 上的 rotateAround 后就不行了。
【问题讨论】:
-
试图转换它希望可以使用的向量:
rigid.angularVelocity = controller.transform.TransformVector(currentAngularVelocity);,但遗憾的是没有运气。 -
也试过了:
localAngularVelocity = transform.InverseTransformVector(currentAngularVelocity);
标签: unity3d quaternions rigid-bodies