Motorworks2 (#141)

* fixing polarity

* allocate motor on motorUsed only

* perform sub-step integration step for better precision
This commit is contained in:
Peli de Halleux
2017-12-28 09:07:57 -08:00
committed by GitHub
parent a9a9a89811
commit 01f7fe633c
5 changed files with 55 additions and 19 deletions

View File

@ -358,14 +358,14 @@ namespace pxsim.visuals {
if (!this.running) return;
const fps = GAME_LOOP_FPS;
let now;
let then = Date.now();
let then = pxsim.U.now();
let interval = 1000 / fps;
let delta;
let that = this;
function loop() {
const animationId = requestAnimationFrame(loop);
that.lastAnimationIds.push(animationId);
now = Date.now();
now = pxsim.U.now();
delta = now - then;
if (delta > interval) {
then = now;