ThreeJS / Ready Player Me / 头部和颈部旋转

发布于 2025-01-18 22:00:26 字数 428 浏览 3 评论 0原文

我有点卡住了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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文