HowTo : Scale + ThinInstances

I also found this post (2021) with this playground as solution.

The solution say to use this code :

const scale = new Vector3(2, 2, 2);
const rot = new Quaternion.RotationYawPitchRoll(Math.PI/3, 0, 0);
const trans = new Vector3(-1, 2, 0);
var newMat = Matrix.Compose(scale, rot, trans);
sphere.thinInstanceSetMatrixAt(idx, newMat);

From what I understand we can also do something like this to avoid Quaternion (which cancel my initial rotation on container load) :

const matrix: Matrix = scaleMatrix
      .multiply(rotationMatrix)
      .multiply(translationMatrix);

UPDATE : this is indeed the solution . But it is not working in the given playground because the buffer is static, see later comments.

Notes :

  • my glb model have a scale of 1, 1, 1. But when I load it, I must set scale it at (1, 1, 1) explicitly otherwise the positioning is totally wrong. Strange behavior which does not help to debug. Updated playground