diff options
[WGL/P] Added coordinates in the top left corner
1 files changed, 5 insertions, 0 deletions
| -rw-r--r-- | Year 2/Computer Graphics with WebGL/Project/spaceship.js | 5 |
diff --git a/Year 2/Computer Graphics with WebGL/Project/spaceship.js b/Year 2/Computer Graphics with WebGL/Project/spaceship.js index 5b98229..a50f2fc 100644 --- a/Year 2/Computer Graphics with WebGL/Project/spaceship.js +++ b/Year 2/Computer Graphics with WebGL/Project/spaceship.js @@ -150,8 +150,13 @@ function mouseInit() { /* * On every draw */ +coordsElem = undefined; + function updateCamera() { for (var i = 0; i < pressedKeys.length; i++) if (pressedKeys[i]) keyAction[i](); lookAt(pos, vecSum(pos, forward.toCartesian()), up.toCartesian()); + if (coordsElem) { + coordsElem.innerText = 'X: '+pos[0]+' Y: '+pos[1]+' Z: '+pos[2]; + } } |
