mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 06:03:26 +02:00
Use deltaTIme to ensure sand updates are somewhat uniform
This commit is contained in:
parent
77b2dd695d
commit
44cf662904
1 changed files with 10 additions and 1 deletions
|
@ -446,7 +446,16 @@ var numAdjacentVoxels = 0;
|
||||||
//Stores a list of voxels we need to activate
|
//Stores a list of voxels we need to activate
|
||||||
var activateMap = {};
|
var activateMap = {};
|
||||||
|
|
||||||
function update() {
|
var UPDATES_PER_SECOND = 12.0; // frames per second
|
||||||
|
var frameIndex = 0.0;
|
||||||
|
var oldFrameIndex = 0;
|
||||||
|
|
||||||
|
function update(deltaTime) {
|
||||||
|
frameIndex += deltaTime * UPDATES_PER_SECOND;
|
||||||
|
if (Math.floor(frameIndex) == oldFrameIndex) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
oldFrameIndex++;
|
||||||
|
|
||||||
//Clear the activate map each frame
|
//Clear the activate map each frame
|
||||||
activateMap = {};
|
activateMap = {};
|
||||||
|
|
Loading…
Reference in a new issue