我想在创建对象时为对象设置一个变换矩阵,然后通过位置、旋转和缩放来控制它,但是虽然更改矩阵确实改变了世界空间中的对象,但它的位置参数仍然保持为 0, 0, 0。
let mesh = new THREE.Mesh(
new THREE.BoxGeometry(),
new THREE.MeshPhongMaterial({color:0xf15728})
)
this.scene.add(mesh)
let pos = new THREE.Vector3().setFromMatrixPosition(m)
mesh.matrixAutoUpdate = false
mesh.matrix.copy(m)
// ***************//
mesh.updateMatrix()
// ***************//
console.log("mesh.position", mesh.position)
console.log("pos", pos)
Run Code Online (Sandbox Code Playgroud)
pos这是和的值的输出mesh.position