nytimes / three-story-controls

A three.js camera toolkit for creating interactive 3d stories
Other
249 stars 21 forks source link

rig.position.set() #26

Open Eytanm opened 2 years ago

Eytanm commented 2 years ago

hi, I want to change the position of my Rig to start FreeMovement from a different position in the model. I can change position of camera but not of rig... this.rig = new CameraRig(this.camera, this.scene) **this.rig.position.set(-2.738747813014968,0,-34.80472085495976);** // this.camera.position.set(-2.738747813014968,0,-34.80472085495976); // this.camera.quaternion.set(-0.016886286519686242,0.9595464380905118,-0.05896608108424796,-0.2747880779017762); this.controls = new FreeMovementControls(this.rig, { panDegreeFactor: 2, wheelScaleFactor: 0.01, keyboardScaleFactor: 0.015, keyboardDampFactor: 0 }) this.controls.enable()

noisyneuron commented 2 years ago

Hi @Eytanm, this is possible with the setworldcoordinates function.

The rig unpacks the transform to a few different objects to allow for more intuitive controls, so setting the position directly might not lead to expected results