Three.js 中的旋转方向或惯用手 [英] Direction of rotation or handedness in three.js

查看:72
本文介绍了Three.js 中的旋转方向或惯用手的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到当我围绕 Z 轴旋转模型时,如下所示:

model.rotateZ(rotatedAngle * Math.PI/180);

它似乎绕轴逆时针旋转.

  • 这个观察准确吗?
  • 这在某处有记录吗?我找不到,可能是我使用了错误的搜索词.
  • 这是可配置的吗?
  • 最重要的是,管理轮换的最佳做法是什么?

解决方案

Three.js 使用

左手系(顺时针),右手系(逆时针)

然后添加一些东西到你的角度逆时针旋转取下东西顺时针旋转.

函数旋转(){mesh1.rotation.z += 0.01;//逆时针旋转mesh2.rotation.z -= 0.01;//顺时针旋转}

此处演示的小提琴

I've noticed that when I rotate my model around the Z axis, like this:

model.rotateZ(rotatedAngle * Math.PI / 180);

it seems to rotate counter-clockwise around the axis.

  • Is this observation accurate?
  • Is this documented somewhere? I couldn't find it, perhaps I'm using the wrong search terms.
  • Is this configurable?
  • Most importantly what is the best practice for managing rotations?

解决方案

Three.js uses the right handed system and this means counter clockwise is default rotation. See here for all rotation rules...

Left the left handed system (clockwise), right the right handed system (counter clockwise)

So then adding something to your angle rotates counter clockwise and removing something rotates clockwise.

function rotate(){
    mesh1.rotation.z += 0.01;  // rotates counter clockwise
    mesh2.rotation.z -= 0.01;  // rotates clockwise
}

A Fiddle here to demonstrate

这篇关于Three.js 中的旋转方向或惯用手的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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