javascript - How to set the OrbitControls target to move around? -
i want orbitcontrols utilize selected object new target "move around". found center/target attribute, i'm not sure how set object selected.
i tried this:
var controls = this.controls = new three.editorcontrols(camera, container.dom); this.orbitcontrols = new three.orbitcontrols( photographic camera ); this.orbitcontrols.damping = 0.5; this.orbitcontrols.addeventlistener( 'change', scenemanager.animate ); var controls = this.controls = new three.orbitcontrols(camera, container.dom); onobjectselected(function(o){ controls.center.fromarray([o.position.x, o.position.y, o.position.z]); }); controls.addeventlistener('change', function () { thisview.transformcontrols.update(); thisview.orbitcontrols.update(); signalhub.signals.camerachanged.dispatch(camera); });
but don't results. used threejs editor code base.
well nevermind, don't want delete this, i'll allow up.
i somehow thought controls manage other stuff, had add together next objectselected callback:
onobjectselected(function(o){ //controls.center.fromarray([o.position.x, o.position.y, o.position.z]); thisview.orbitcontrols.center.fromarray([o.position.x, o.position.y, o.position.z]); });
javascript camera three.js
No comments:
Post a Comment