Skip to content

Commit 836a26a

Browse files
authored
Merge pull request #6 from martinRenou/camera_update
Add support for setting/getting camera position
2 parents 596debf + a3dae24 commit 836a26a

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/Scene.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,30 @@ class Renderer {
140140
this.renderer.setClearColor(new THREE.Color(this.color), this.opacity);
141141
}
142142

143+
set cameraPosition (position: THREE.Vector3) {
144+
this.camera.position.set(position.x, position.y, position.z);
145+
}
146+
147+
get cameraPosition () {
148+
return this.camera.position;
149+
}
150+
151+
set cameraUp (position: THREE.Vector3) {
152+
this.camera.up.set(position.x, position.y, position.z);
153+
}
154+
155+
get cameraUp () {
156+
return this.camera.position;
157+
}
158+
159+
set cameraTarget (position: THREE.Vector3) {
160+
this.controls.target.set(position.x, position.y, position.z);
161+
}
162+
163+
get cameraTarget () {
164+
return this.controls.target;
165+
}
166+
143167
/**
144168
* Animation
145169
*/

0 commit comments

Comments
 (0)