Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let position = new THREE.Vector3();
- position.applyMatrix4(transform)
- // Get the position from the current transform matrix.
- let position = new THREE.Vector3();
- position.setFromMatrixPosition(transform); <===== A
- // Create a matrix to do rotation of -90 degrees on the z axis.
- let rotateTransform = new THREE.Matrix4();
- rotateTransform.makeRotationFromEuler(new THREE.Euler(0, 0, MyHelper.ConvertToRadian(-90)));
- // Apply the rotation
- transform.multiply(rotateTransform);
- // Get the position again. Should be different result to above
- position.setFromMatrixPosition(transform); <===== B
- // Try a different approach
- let transform3 = new THREE.Matrix4();
- let quat2 = new THREE.Quaternion();
- quat2.setFromEuler(new THREE.Euler(MyHelper.ConvertToRadian(-90),0 , 0));
- transform3.compose(new THREE.Vector3(0,0,0), quat2, new THREE.Vector3(0,0,0));
- transform.multiply(transform3);
- absPos.setFromMatrixPosition(transform); <====== C
Add Comment
Please, Sign In to add comment