From eafd6fc01ee0ca9394fd1934856f9a0ec0714938 Mon Sep 17 00:00:00 2001 From: polygonboutique Date: Mon, 21 Nov 2016 08:20:47 +0100 Subject: [PATCH] height maps --- src/game-lib-game.js | 2 +- src/game-lib-vector-3.js | 6 ++++++ src/game-lib-world.js | 7 ++++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/game-lib-game.js b/src/game-lib-game.js index c6217f2..592b74f 100644 --- a/src/game-lib-game.js +++ b/src/game-lib-game.js @@ -44,7 +44,7 @@ GameLib.D3.Game.prototype.update = function( for(var w in scene.worlds) { var world = scene.worlds[w]; // NOTE: We are calling the step function with a variable timestep! - world.step(dt); + world.step(fixedDt, dt); } scene.update(dt); diff --git a/src/game-lib-vector-3.js b/src/game-lib-vector-3.js index fc7ebf5..d6396e7 100644 --- a/src/game-lib-vector-3.js +++ b/src/game-lib-vector-3.js @@ -66,6 +66,12 @@ GameLib.D3.Vector3.prototype.copy = function () { ); }; +GameLib.D3.Vector3.prototype.set = function (x, y, z) { + this.x = x; + this.y = y; + this.z = z; +}; + GameLib.D3.Vector3.prototype.lerp = function ( v, alpha ) { return new GameLib.D3.Vector3( this.x + ( v.x - this.x ) * alpha, diff --git a/src/game-lib-world.js b/src/game-lib-world.js index 44d0f65..76eb306 100644 --- a/src/game-lib-world.js +++ b/src/game-lib-world.js @@ -103,8 +103,13 @@ GameLib.D3.World.prototype.addVehicle = function( }; GameLib.D3.World.prototype.step = function( - timeStep + fixedStep, + dtStep ) { + this.instance.step(fixedStep, dtStep, 3); + return; + + // todo: figure out, why this call to internal step is more stable for trimesh collisions..... //this.instance.internalStep(timeStep); //return;