Hi, I load model.glb and I set position is (1,0,-2).
Now, I use this code to rotate but it show on screen changed position although I check log I see after rotating object keep position (1,0,-2).
I want to just rotate around itself and keep position (1,0,-2) when show on screen
const pivot = draggableModel.position.clone(); // use object position as the pivot point
pivot.y += 0.25; // move pivot up by half of object height (adjust as needed)
console.log(“1:”,draggableModel.position)
// Translate the object to the pivot point
draggableModel.translateX(-pivot.x);
draggableModel.translateY(-pivot.y);
draggableModel.translateZ(-pivot.z);
console.log(“2:”,draggableModel.position)
// Rotate the object around the Y-axis
const angle = THREE.MathUtils.degToRad(90);
const axis = new THREE.Vector3(0, 1, 0);
const rotationMatrix = new THREE.Matrix4().makeRotationAxis(axis, angle);
draggableModel.applyMatrix4(rotationMatrix);
console.log("3:",rotationMatrix)
// Translate the object back to its original position
draggableModel.translateX(pivot.x);
draggableModel.translateY(pivot.y);
draggableModel.translateZ(pivot.z);