Copy THREE.js Matrix From Object
i need to to same matrix mulitiply in Three.js. I had an Object3D and i get the right matrix to console.log when doing this: console.log (scene.getObjectByName( 'Pointer' ).matri
Solution 1:
three.js will update the object matrix when it render the page according the object position, scale, rotation. So when you set the object matrix, it will sooner be rewrited. To manually set the object matrix, you have to set autoupdate to false.
object.matrixAutoUpdate = false;
then use the your code.
var newMat = new THREE.Matrix4();
console.log(scene.getObjectByName("Pointer").matrix.elements)
// output: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]
newMat = newMat.copy(scene.getObjectByName("Pointer").matrix);
console.log(newMat);
Post a Comment for "Copy THREE.js Matrix From Object"