Merge pull request #3177 from Barnold1953/OculusSDK

Use deltaTIme to ensure sand updates are somewhat uniform
This commit is contained in:
Brad Hefta-Gaub 2014-07-16 12:36:52 -07:00
commit cc7da35722

View file

@ -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 = {};