Hello, I want to be able to rotate the object after clicking it, and click the object again after rotating it.
But I can’t do it now. I can’t trigger the SelectionEvent after clicking on the rotated object.
I’m not sure if it has something to do with the updatematrix of three.js
The following is my code, thanks for the answer
viewer.on(ViewerEvent.ObjectClicked, (selectionEvent: SelectionEvent) => {
if (selectionEvent && selectionEvent.hits) {
const firstHitGuid = selectionEvent.hits[0].guid;
if (firstHitGuid) {
const objects = viewer.getObjects(firstHitGuid)
const position = { value: { x: 0, y: 0, z: 0 } }
const rotation = { value: { x: 1, y: 0, z: 0 } }
const scale = { value: { x: 1, y: 1, z: 1 } }
const unionBox: any = new Box3();
objects.forEach((obj: BatchObject) => {
unionBox.union(obj.renderView.aabb)
})
const origin = new Vector3(1, 0, 0)
objects.forEach((obj: BatchObject) => {
obj.transformTRS(position.value, rotation.value, scale.value, origin)
viewer!.getRenderer().markTransformsDirty(obj.renderView.batchId)
})
}
}
})