From 53c630554ce3693de9e958f87201b9f6485d09c7 Mon Sep 17 00:00:00 2001 From: Thomas FORGIONE Date: Mon, 11 May 2015 16:47:45 +0200 Subject: [PATCH] Added more recommendation --- static/js/PointerCamera.js | 4 ++-- static/js/prototype/ArrowCamera.js | 2 +- static/js/prototype/Coin.js | 10 ++++----- static/js/prototype/initScene.js | 36 +++++++++++++++++++++++++++--- 4 files changed, 41 insertions(+), 11 deletions(-) diff --git a/static/js/PointerCamera.js b/static/js/PointerCamera.js index b6e5b94..269a5ca 100644 --- a/static/js/PointerCamera.js +++ b/static/js/PointerCamera.js @@ -318,8 +318,8 @@ PointerCamera.prototype.onMouseUp = function(event) { } PointerCamera.prototype.log = function() { - console.log("(" + this.position.x + "," + this.position.y + ',' + this.position.z + ')'); - console.log("(" + this.target.x + "," + this.target.y + ',' + this.target.z + ')'); + console.log("createCamera(\nnew THREE.Vector3(" + this.position.x + "," + this.position.y + ',' + this.position.z + '),\n' + + "new THREE.Vector3(" + this.target.x + "," + this.target.y + ',' + this.target.z + ')\n)'); } PointerCamera.prototype.save = function() { diff --git a/static/js/prototype/ArrowCamera.js b/static/js/prototype/ArrowCamera.js index 13e4a4e..402ba12 100644 --- a/static/js/prototype/ArrowCamera.js +++ b/static/js/prototype/ArrowCamera.js @@ -136,7 +136,7 @@ ArrowCamera.prototype.regenerateArrow = function(mainCamera) { var limit = this.fullArrow ? 0.1 : 0.3; // for (var i = this.fullArrow ? 0 : 0.5; i <= 1.001; i += 0.05) { - for (var i = 1; i > limit; i -= 0.025) { + for (var i = 1; i > limit; i -= 0.05) { point = hermite.eval(i); deriv = hermite.prime(i); up.cross(deriv); diff --git a/static/js/prototype/Coin.js b/static/js/prototype/Coin.js index eafcfe5..a510569 100644 --- a/static/js/prototype/Coin.js +++ b/static/js/prototype/Coin.js @@ -10,12 +10,13 @@ Coin.prototype.init = function(x,y,z) { this.mesh.position.x = x; this.mesh.position.y = y; this.mesh.position.z = z; - this.mesh.raycastable = true; this.ready = true; + this.mesh.raycastable = true; } else { (function(self,x,y,z) { setTimeout(function() { self.init(x,y,z); + Coin.nextSound = new Audio(static_path + 'data/music/redcoins/1.mp3'); },1000); })(this,x,y,z); } @@ -39,13 +40,12 @@ Coin.prototype.get = function() { this.got = true; this.mesh.visible = false; Coin.total ++; - var sound = new Audio('/static/data/music/redcoins/' + Coin.total + '.mp3'); - sound.play(); - console.log(sound) + Coin.nextSound.play(); + Coin.nextSound = new Audio('/static/data/music/redcoins/' + Coin.total + '.mp3'); } } -Coin.total = 0; +Coin.total = 1; Coin.BASIC_MESH = null; Coin._loader = new THREE.OBJLoader(); diff --git a/static/js/prototype/initScene.js b/static/js/prototype/initScene.js index 8efce0a..9ced37d 100644 --- a/static/js/prototype/initScene.js +++ b/static/js/prototype/initScene.js @@ -191,12 +191,14 @@ function createBobombCoins() { var coins = []; coins.push( - new Coin(30.451451579494677,12.95882671478358,-4.441244895059621), + new Coin(-1.6204001515660262,12.245208850063094,-24.871861611322934), + new Coin(23.509767766131876,13.6929075780209,-6.1716274892265615), + new Coin(34.797219873325524,13.088500612704706,-2.1784858128827413), new Coin(-23.255456493345882,15.763954882327724,-11.08029248078497), new Coin(-7.238094745133173,12.95460420281499,-3.1009487490121885), new Coin(-17.10578612221326,24.17871082944758,-11.574224169812915), - new Coin(-19.696802461559027,29.787916906980758,17.187300848990844), - new Coin(-12.418656949661646,17.09780294217035,32.472022253887665) + new Coin(-12.418656949661646,17.09780294217035,32.472022253887665), + new Coin(7.132802719121488,8.802400710545713,22.258165594421055) ); return coins; @@ -221,6 +223,14 @@ function createBobombCameras(width, height) { new THREE.Vector3(-24.10987782946019,26.75997424452833,-24.7814217620827), new THREE.Vector3(-13.724964120740987,14.939165978074758,11.993869660150779) ), + createCamera( + new THREE.Vector3(7.162458619916293,18.414234017280627,-10.871480453809644), + new THREE.Vector3(-27.47061192698706,3.9199238382137196,2.9294396939998144) + ), + createCamera( + new THREE.Vector3(19.741775033926334,14.132046557015727,-25.338452829449857), + new THREE.Vector3(-18.0898892760213,1.5191520612050162,-28.449733590966297) + ), createCamera( new THREE.Vector3(-13.484471970922971,20.25938194278451,-30.850247430073622), new THREE.Vector3(-42.04654352929252,-7.608886431102082,-28.099304657929874) @@ -228,6 +238,26 @@ function createBobombCameras(width, height) { createCamera( new THREE.Vector3(23.58849177613168,18.628351213754488,31.516769692916675), new THREE.Vector3(8.319765065757787,-0.5486703304136178,-0.09189730426033549) + ), + createCamera( + new THREE.Vector3(5.068708131530766,11.201320390433953,9.77462743108436), + new THREE.Vector3(9.20744154720096,3.8549750522404134,48.87580511010085) + ), + createCamera( + new THREE.Vector3(37.24445046448742,17.56004329173052,-13.432945825465112), + new THREE.Vector3(15.446296842638255,0.7142524861838169,15.568085721947512) + ), + createCamera( + new THREE.Vector3(4.18086580540298,16.54831275414988,29.96253548469186), + new THREE.Vector3(-17.059296481928556,3.408610856102113,-1.2817238286325505) + ), + createCamera( + new THREE.Vector3(-44.56340663230823,22.567957426093283,14.856920056929788), + new THREE.Vector3(-20.052660826451827,7.556450599683849,42.67558290835663) + ), + createCamera( + new THREE.Vector3(11.29580093093769,15.03666008708929,31.377195488571406), + new THREE.Vector3(-28.288314738873957,13.648654387264967,25.794075678265735) ) // createCamera( // new THREE.Vector3(28.438969076366728,18.888756501203087,26.694456000440766),