Hi, guys!
I’m rewriting an old project from three.js to babylon.js, in which the server side only stores vertices data and matrix, the browser side need to use both to re-assemble to a final mesh.
in three.js they just use:
geometry.applyMatrix(matrix)
and it worked!
This function in Three.js actually modified the vertices data, as the same in babylon.js, firstly I tried to use
mesh.BakeTransformIntoVertices(matrix)
but the result is totally a mess.
Then I turned to
let scaling = new BABYLON.Vector3()
let rotationQuaternion = new BABYLON.Quaternion()
let position = new BABYLON.Vector3()
matrix.decompose(scaling, rotationQuaternion, position)
mesh.scaling = scaling
mesh.rotationQuaternion = rotationQuaternion
mesh.position = position
But it doesn’t work neither.
I also tried
vertexData.transfrom(matrix)
which doesn’t work neither.
So, in babylon.js how to do the same thing as in three.js for applying matrix to a mesh?
ps:
once vertexData.applyToMesh(mesh), does this vertexData being bounded to the mesh? if so, how could I deeply clone a copy of a BABYLON.VertexData before applyToMesh()?