Issue with cloning - Last object not in the right place

Hi

I have created a code pen to illustrate my problem : https://codepen.io/odecharette/pen/ExpNPpX

I need to clone several objects in the same session

I want to have :
1 object Left
5 object Front (this is parametric, can be from 1 to 20)
1 object Right

1 manage to clone and place Left and front Object
But when I clone the last object, then it goes somewhere I don’t want…

Questions :
1/ How to place correctly my last object?

2/ How to hide the first object that was used only for clone?

image

Hope you can understand my issue :slight_smile:
Thanks
Olivia

The problem seems to be in how you use quaternions. You might be better off using the fromEuler function.

Hiding showing a node: ITreeNode | Viewer

Thanks

Can you give me an example on how to use fromEuler ?

I tried

clonedNode.transformations.push({
    id: "transformation",
    matrix: mat4.fromRotationTranslation(
      mat4.create(),
      quat.fromEuler(quat, 0, 0, 90),
      vec3.fromValues(x, y, 0)
    )
  })
clonedNode.transformations.push({
    id: "transformation",
    matrix: mat4.fromEuler(quat, 0, 0, 90)
  })