【发布时间】:2020-11-01 14:51:14
【问题描述】:
我想在创建对象时为对象设置一个变换矩阵,然后通过位置、旋转和缩放来控制它,但是虽然更改矩阵确实会更改世界空间中的对象,但它的位置参数仍然保持为 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)
这是pos 和mesh.position 的值的输出
【问题讨论】:
标签: matrix three.js transformation