mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 09:44:21 +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,8 +446,17 @@ var numAdjacentVoxels = 0;
|
|||
//Stores a list of voxels we need to activate
|
||||
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
|
||||
activateMap = {};
|
||||
|
||||
|
|
Loading…
Reference in a new issue