Hello,
Up to this point, I hadn’t encountered any issues as I hadn’t been using thin instances. However, thin instances have now introduced a translation problem whenever I attempt to scale models. As someone relatively new to 3D development, despite scouring numerous forum posts, I’ve been unable to find a solution.
I use the assetsManager
to load assets, and due to variations in the sizes of models, upon the successful completion of a task in the assetsManager
, I apply a scale (as defined in a configuration file).
For instance, I apply a scale of 0.01 to task.loadedMeshes
(which contains 3 meshes) simply by using: node.scaling = new Vector3(0.01, 0.01, 0.01);
on each mesh (since the model is very large).
Upon rendering, I see my model scaled as expected. However, when I attempt to translate the model using a matrix, it barely moves; it’s as if it’s operating within its “local matrix” or something like that.
Initially, I had:
const matrix: Matrix = Matrix.Translation(x, y, z);
thinInstancesWorldMatrices.set(matrix.toArray(), id * 16);
I considered that perhaps I should multiply the matrix with a scaling matrix, but the outcome seemed even worse. I also tried to scale the root node (rootnodes[0]
) of InstantiatedEntries
from container.instantiateModelsToScene
, the scaling is working but change nothing to the translation problem.
In reality, I’m facing a similar issue with rotation: I apply a rotation upon task load (also by configuration). However, when I endeavor to move the unit in a particular direction, at times, it moves in the opposite direction, seemingly influenced by the initial rotation.
Could you advise on how to correctly implement transformations on a loaded container/mesh, such as rotation or scaling please ?
This video illustrates the problem: https://youtu.be/uoFXEefp1Mo
I try to understand this post…
Other question: if we have a “character mesh” with children meshes, we can use the same thinInstance matrix for each child right ?
Thank you