Permalink
Browse files

hit x to set camera

  • Loading branch information...
1 parent 2ba96a0 commit 2c57e849ec29f2a6a35b262aa50a6d96bdf794e2 @maxogden committed Apr 5, 2013
Showing with 9 additions and 1 deletion.
  1. +8 −0 demo.js
  2. +1 −1 index.html
View
8 demo.js
@@ -70,6 +70,7 @@ function setup(game, avatar) {
if (ev.keyCode === 16) shiftDown = true
if (ev.keyCode === 'R'.charCodeAt(0)) avatar.toggle()
if (ev.keyCode === 13) shutter()
+ if (ev.keyCode === 88) setCamera()
})
window.addEventListener('keyup', function (ev) {
@@ -109,6 +110,13 @@ resetButton.addEventListener('click', function(e) {
stopMotion.createEncoder()
})
+function setCamera() {
+ var els = game.camera.matrixWorld.elements
+ var pos = {x: els[12], y: els[13], z: els[14]}
+ stop.cam.position.copy(pos)
+ stop.cam.lookAt(new game.THREE.Vector3(0,0,-1).applyMatrix4(game.camera.matrixWorld))
+}
+
function shutter() {
var imageURI = stopMotion.shutter()
var img = new Image()
View
2 index.html
@@ -22,7 +22,7 @@
<span id="middleMessage" class="big">Loading... please wait</span>
<br>
<span>(ENTER = Take photo, W, A, S, D = Move, SPACE = Jump,
- <br>MOUSE = Look around, R = Switch perspective,
+ <br>MOUSE = Look around, R = Switch perspective, X = Set camera,
<br>CTRL+CLICK = Place block, SHIFT+CLICK = begin + end bulk edit)
<br>
<br>made by @maxogden with @voxeljs</span>

0 comments on commit 2c57e84

Please sign in to comment.