var rotationMatrix = new THREE.Matrix4();
var position = new THREE.Vector3( 1000, 1000, 0 );
var angle = Math.PI / 4;
var axis = new THREE.Vector3( 1, 0.5, 0 ).normalize();
function render() {
/** Adds a rotation of rad to the obj's rotation about world's axis */
rotationMatrix.makeRotationAxis( axis, angle ).multiplyVector3( position );
tubeMesh.matrix = rotationMatrix;
tubeMesh.rotation.getRotationFromMatrix(rotationMatrix, tubeMesh.scale);
renderer.render( scene, camera );
}
我使用了这些 URL 中的代码:
我收到错误“Uncaught TypeError: Cannot call method 'makeRotationAxis' of undefined”。这里rotationMatrix
定义为THREE.Matrix4()
,与上面链接中给出的代码相同。我正在使用three.js 库的r51。