EnZ*_*nZo 15 javascript three.js
是否有可能轮换世界的轴而不是物体?
我需要做一些物体的旋转,但是在第一次旋转后,我不能像我想的那样做其他旋转.
如果无法在世界轴上进行旋转,我的第二个选择是在第一次旋转后重置轴.这有什么功能吗?
我无法使用,object.eulerOrder因为它在我object.eulerOrder="YZX"进行一些旋转后设置时会改变对象的方向.
Nei*_*eil 16
是的,您可以使用在three.js github问题上提供的函数来执行此操作:
// select the Z world axis
this.myAxis = new Vector3(0, 0, 1);
// rotate the mesh 45 on this axis
this.mesh.rotateOnWorldAxis(this.myAxis, Math.degToRad(45));
animate() {
// rotate our object on its Y axis,
// but notice the cube has been transformed on world axis, so it will be tilted 45deg.
this.mesh.rotation.y += 0.008;
}
Run Code Online (Sandbox Code Playgroud)
然后
// select the Z world axis
this.myAxis = new Vector3(0, 0, 1);
// rotate the mesh 45 on this axis
this.mesh.rotateOnWorldAxis(this.myAxis, Math.degToRad(45));
animate() {
// rotate our object on its Y axis,
// but notice the cube has been transformed on world axis, so it will be tilted 45deg.
this.mesh.rotation.y += 0.008;
}
Run Code Online (Sandbox Code Playgroud)
看我的例子 - http://jsfiddle.net/SCXNQ/156/
| 归档时间: |
|
| 查看次数: |
19156 次 |
| 最近记录: |