Object controls - rotate object around it's own local axis center

Hi all,

I am trying to use object controls to rotate an object on it’s own local axes

This is the link to the control I am using

I set it up as follows

var object;
var loader = new THREE.OBJLoader();
object = loader.parse(objtext);

var objectControl= new THREE.ObjectControls(camera, renderer.domElement, object);
objectControl.setDistance(8, 200); // set min - max distance for zoom
objectControl.setZoomSpeed(0.5); // set zoom speed
objectControl.setMaxVerticalRotationAngle(Math.PI / 4, Math.PI / 4);

I can move it around with my mouse but it’s not rotating around the center point of the object. Is there an easy way to accomplish this with this control?


Notice that OBJLoader does return an instance of THREE.Group. Depending on the OBJ asset, the group might have multiple objects as children. A children’s position does not necessarily represent its center point.

So you might want to check first how object is structured. It’s probably necessary to select the right mesh, center it and then pass it to ObjectControls.

Thanks for the feedback. OK I’ll try our suggestion.

Should I get a bounding box of the mesh object and set the object position to the opposite of what the box translation is relative to 0,0,0?