统一 - 旋转的物体在使用四合一时以一种奇怪的方式翻转
我正在尝试在VR中创建一个系统,其中对象旋转跟随玩家手的旋转。不幸的是,当手以高角度旋转时,旋转的物体以一种奇怪的方式翻转,好像旋转从360度变为0。不允许我根据以下方面更改“灵敏度”:
- 1-目标是旋转1:1的比率
- 2-目标的旋转是手的两倍等
。
// In FixedUpdate
Quaternion deltaRotation = Quaternion.Inverse(target.rotation) * hand.rotation;
deltaRotation.ToAngleAxis(out float angle, out Vector3 axis);
target.rotation *= Quaternion.AngleAxis(angle * sensitivity, axis);
任何帮助都将不胜感激!
I'm trying to create a system in VR in which an object rotation follows the rotation of the player's hand. Unfortunately, when the hand rotates at a high angle, the rotated object flips in a strange way as if it had a problem with the rotation change from 360 degrees to 0. I tried many ways to solve this problem, but each one that worked did not allow me to change "sensitivity" on the basis of:
- 1 - target is rotating 1: 1 ratio with hand
- 2 - target is rotating twice as much as hand
etc.
// In FixedUpdate
Quaternion deltaRotation = Quaternion.Inverse(target.rotation) * hand.rotation;
deltaRotation.ToAngleAxis(out float angle, out Vector3 axis);
target.rotation *= Quaternion.AngleAxis(angle * sensitivity, axis);
Any help would be appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
因此,问题在于,
如果灵敏度为!= 1这些对象旋转变得不同步,因此三角骨无法为您带来期望的价值。您可能想检查自上次帧以来的手旋转多少,这样:
So the problem is in
if the sensitivity is != 1 these objects rotations get desynchronized so the deltaRotation will not give you the value you expect. You probably wanted to check how much hand rotated since last frame, like that: