Corrected bugs, and prepare for tutorial

This commit is contained in:
Thomas FORGIONE
2015-07-22 14:48:14 +02:00
parent 9b319f3c33
commit 3c59dce3a6
11 changed files with 95 additions and 26 deletions

View File

@@ -248,16 +248,19 @@ L3D.PointerCamera.prototype.onPointerLockChange = function() {
} else {
this.pointerLocked = false;
this.mousePointer.clear();
if (this.mousePointer)
this.mousePointer.clear();
this.mouseMove.x = 0;
this.mouseMove.y = 0;
// Draw start canvas only if should lock
if (this.shouldLock)
this.startCanvas.render();
else
this.startCanvas.clear();
if (this.startCanvas) {
if (this.shouldLock)
this.startCanvas.render();
else
this.startCanvas.clear();
}
event.locked = false;
@@ -275,14 +278,14 @@ L3D.PointerCamera.prototype.onPointerLockChange = function() {
* @param {Number} time number of milliseconds between the previous and the next frame
*/
L3D.PointerCamera.prototype.update = function(time) {
this.shouldLogCameraAngles = false;
if (this.moving) {
this.shouldLogCameraAngles = false;
this.linearMotion(time);
} else if (this.movingHermite) {
this.shouldLogCameraAngles = false;
this.hermiteMotion(time);
} else {
this.shouldLogCameraAngles = true;
this.normalMotion(time);
}
};

View File

@@ -94,6 +94,7 @@ L3D.ReplayCamera.prototype.nextEvent = function() {
// Finished
if (this.counter >= this.path.length) {
this.started = false;
console.log('The replay is finished');
return;
}

View File

@@ -72,20 +72,28 @@ L3D.resetPeachElements = function() {
};
};
L3D.initPeach = function(recommendation, scene, coins, clickable) {
L3D.initPeach = function(camera, scene, coins, clickable, coin_ids) {
L3D.addLight(scene);
var collidableObjects = [];
L3D.initPeachCastle(scene, collidableObjects, recommendation, clickable);
L3D.initPeachCastle(scene, collidableObjects, camera, clickable);
recommendation.resetElements = L3D.resetPeachElements();
recommendation.collidableObjects = collidableObjects;
camera.resetElements = L3D.resetPeachElements();
camera.collidableObjects = collidableObjects;
recommendation.speed = 0.001;
recommendation.reset();
recommendation.save();
camera.speed = 0.001;
camera.reset();
camera.save();
scene.add(recommendation);
scene.add(camera);
var tmp = L3D.generateCoins(L3D.createPeachCoins(), coin_ids);
for (var i in tmp) {
coins.push(tmp[i]);
}
setTimeout(function() { coins.forEach(function(coin) { coin.addToScene(scene); });}, 1000);
Coin.init(0.001);
var recommendations = [];

View File

@@ -1,7 +1,7 @@
L3D.ObjectClicker = (function() {
function pointerCheck(camera) {
return (camera instanceof L3D.PointerCamera && camera.pointerLocked);
return ((camera instanceof L3D.PointerCamera || camera instanceof TutoCamera) && camera.pointerLocked);
}
/**