Skip to content

How to have multiple Worlds (globe vs ground simulation)

  1. Create two worlds:
1
2
const globeWorld = new World();
const groundWorld = new World();
  1. Give each one its own schedule (recommended):
1
2
const globeSched  = new Schedule();
const groundSched = new Schedule();
  1. Run both each frame (same dt):
1
2
globeSched.run(globeWorld, dt, ["input", "sim", "render"]);
groundSched.run(groundWorld, dt, ["input", "sim", "render"]);
  1. Share data explicitly between worlds (pick one):

  2. copy values at a known point (end of sim, start of other sim)

  3. or have a “bridge” step in your outer loop that reads from one world and writes into the other (via normal add/set or via cmd() + flush())