Hi Everyone, How does the position of the gizmo of TransformControls work?
if (clickedOb)
{
this.selectObject(clickedObj);
const center = getCentroid(clickedObj);
if (center) {
this.sm.xFromControls.getHelper().position.copy(center);
}
this.sm.xFromControls.attach(clickedObj);
} else {
this.selectObject(null);
this.sm.xFromControls.detach();
}
On clicking the object, I am attaching the object to the controls and setting the position of the gizmo to the object’s center. After moving the object, if I select the object again, the gizmo position does not appear at the center of the object. If I do not set the gizmo position, the default position of the gizmo is (0,0,0) even after attaching the object.
First-time selection
object is translated
Selecting again (gizmo is moved from object center.)
Any assistance is appreciated.