【发布时间】:2018-05-30 02:58:35
【问题描述】:
更改对象的旋转属性值是否会围绕世界轴或对象的轴旋转对象?例如
object.rotation.x += 2
这会围绕世界 X 轴或对象的 X 轴旋转对象吗? 我尝试了以下示例:
var materials = [];
materials.push( [ new THREE.MeshBasicMaterial( { color: 0xff0000 } ) ] );
materials.push( [ new THREE.MeshBasicMaterial( { color: 0xff0000 } ) ] );
materials.push( [ new THREE.MeshBasicMaterial( { color: 0x00ff00 } ) ] );
materials.push( [ new THREE.MeshBasicMaterial( { color: 0x00ff00 } ) ] );
materials.push( [ new THREE.MeshBasicMaterial( { color: 0x0000ff } ) ] );
materials.push( [ new THREE.MeshBasicMaterial( { color: 0x0000ff } ) ] );
object = new THREE.Mesh( new THREE.CubeGeometry( 20, 20, 20, 1, 1, 1, materials ), new THREE.MeshFaceMaterial() );
object.position.x = 0;
object.position.y = 0;
object.position.z = 0;
object.rotation.x = 0;
object.rotation.y = 0;
object.rotation.z = 0;
object.scale.x = 1;
object.scale.y = 1;
object.scale.z = 1;
scene.add( object );
After i have added the object to the scene i tried the following -
object.rotation.x += Math.PI/4;
object.rotation.y += Math.PI/4;
object.rotation.z += Math.PI/4;
到现在为止,对象相对于它自己的 X、Y 和 Z 轴旋转。 但这样做:
object.rotation.x += Math.Pi/4;
现在将对象围绕世界 X 轴而不是对象的 X 轴旋转 45 度。
【问题讨论】:
标签: three.js