I created a toolbox that can rotate and reposition a mesh with an axis in the middle. When I separate rotation and position, then the position will return to the previous one. However this causes rotation not on the mesh. So what I do is use multiply. But this is not what I expected because the mesh position should be where I marked it (not in mesh axis). How to rotate and position the object so that it remains in the specified position and rotate at that location ? Here is my code :
const translation = new THREE.Matrix4().makeTranslation(
this.valueAOA_X,
this.valueAOA_Y,
this.valueAOA_Z
);
const angleRadian = CoordinateConverter.degreeToRadian(
this.valueAOA_Rotation
);
const rotationAOA = new THREE.Matrix4().makeRotationZ(angleRadian);
this.selectedModel.setPlacementTransform(
rotationAOA.multiply(translation)
);
Fixed it by this line:
this.selectedModel.setPlacementTransform(
translation.multiply(rotationAOA)
);