Corrected bugs of time in old files

Provoked by the fact that Camera.update needs a time
This commit is contained in:
Thomas FORGIONE 2015-06-15 08:45:42 +02:00
parent 0391f62732
commit be99ba00e6
2 changed files with 9 additions and 3 deletions

View File

@ -2,6 +2,7 @@ var renderer, scene, camera, controls, cube, container, plane, mouse= {x:0, y:0}
var raycaster;
var objects = [];
var container_size = new Object();
var previousTime;
container_size.width = 1067;
container_size.height = 600;
@ -57,7 +58,9 @@ function animate() {
cube.update();
camera.update();
var currentTime = Date.now() - previousTime;
camera.update(isNaN(currentTime) ? 20 : currentTime);
previousTime = Date.now();
camera.look();
renderer.render(scene, camera);

View File

@ -5,7 +5,7 @@ var objects = [];
var spheres = new Array(mesh_number);
var visible = 0;
var loader;
var loader, previousTime;
var container_size = new Object();
container_size.width = 1067;
@ -79,7 +79,10 @@ function animate() {
// on appelle la fonction animate() récursivement à chaque frame
requestAnimationFrame(animate);
camera.update();
var currentTime = Date.now() - previousTime;
camera.update(isNaN(currentTime) ? 20 : currentTime);
previousTime = Date.now();
camera.look();
renderer.render(scene, camera);