urbien / urbini

Urbini ideas are now part of Tradle https://github.com/tradle, see also
http://tradle.io
30 stars 5 forks source link

how should the time be synchronized between the main thread (renderer) and the webworker (world)? #6

Open urbien opened 10 years ago

urbien commented 10 years ago

We implemented the world in the web worker. The main thread (renderer) is stepped by a requestAnimationFrame (raf). How should the world be stepped?

  1. move them synchronously. Raf issues postMessage to worker to step the world.
  2. move them independently. Use a timeout in the worker with interval 1000/60. May be interval needs to be a 1000/(60*2)
  3. move them independently but do not let the world to go ahead too much. Not sure I understand this solution but it is what cannon.js does in this example

This issue may depend on the design of #4 for variable timeframe physics.