ThreeJS / Ready Player Me / 头部和颈部旋转
我有点卡住了Avatar(Ready Player ME)的旋转,该旋转遵循用户的视角摄像机由PointerlockControls控制。
阿凡达(Avatar)具有以下层次结构: - 骨头(父母) - 骨头(儿童)
目标是将当前的摄像头旋转并在头部和颈部之间拆分。
我希望头部旋转不超过PI/2(甚至PI/4)每个方向(XYZ)。其余的旋转应由脖子管理。即使颈部对x和z是静态的,并且仅在y周围旋转也可以
。 NeckRotationy = camerarotationy< pi/2? 0:摄影 - (摄影%pi/2); 头部电流=摄像头%pi/2;
一切都起作用,直到相机开始向后看。与其旋转y旋转以在2pi的后面旋转,不如绕x和z旋转,因此简单的公式不起作用。
SMDY可以让我了解如何将相机旋转分离为脖子和头部旋转?
谢谢!
I'm a bit stuck implementing rotation of the avatar (Ready Player Me) that follows user's perspective camera controlled by PointerLockControls.
Avatar has the following hierarchy:
-bone Neck (parent)
-bone Head (child)
The goal is to take the current camera rotation and split it between the Head and Neck.
I want the head to rotate not more than PI/2 (or even PI/4) each direction (XYZ). The rest of the rotation should be managed by the Neck. It should be fine even if the Neck will be static for X and Z and rotate only around Y.
If I do a simple subtraction following the formula (I skip the logic for signs):
neckRotationY = cameraRotationY < PI/2 ? 0 : cameraRotationY - (cameraRotation % PI/2);
headRotationY = cameraRotation % PI/2;
everything works until camera starts looking backwards. Instead of rotating around Y to look behind at 2PI, the camera is rotated around X and Z, so the simple formula doesn't work.
Could smdy get me any idea of how can I separate camera rotation into neck and head rotations?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论