mirror of
https://github.com/wassname/GarageServer.IO.git
synced 2026-07-13 00:50:08 +08:00
Interpolation cleanup/tweak progress
This commit is contained in:
@@ -23,6 +23,7 @@ window.GarageServerIO = (function (window, socketio) {
|
||||
this.clientTime;
|
||||
this.renderTime = 0;
|
||||
this.renderDelta = 0;
|
||||
this.tickerTime = new Date().getTime(),
|
||||
this.physicsDelta;
|
||||
this.stateDelta;
|
||||
this.playerId;
|
||||
@@ -36,6 +37,7 @@ window.GarageServerIO = (function (window, socketio) {
|
||||
setTime: function (serverTime) {
|
||||
this.clientTime = serverTime;
|
||||
this.renderTime = this.clientTime - this.interpolationDelay;
|
||||
this.renderDelta = 0;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -283,6 +285,10 @@ window.GarageServerIO = (function (window, socketio) {
|
||||
},
|
||||
|
||||
getPlayerStates = function (stateCallback) {
|
||||
var newTickTime = new Date().getTime();
|
||||
_stateController.renderDelta += (newTickTime - _stateController.tickerTime);
|
||||
_stateController.tickerTime = newTickTime;
|
||||
|
||||
if(_options.interpolation && _options.onInterpolation) {
|
||||
getPlayerStatesInterpolated(stateCallback);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user