piqnt / planck.js

2D JavaScript Physics Engine
http://piqnt.com/planck.js/
MIT License
4.91k stars 236 forks source link

When setPosition is called, the ball is suspended in mid-air #215

Closed theajack closed 2 years ago

theajack commented 2 years ago

When setPosition is called, the ball is suspended in mid-air

https://piqnt.com/planck.js/Pinball

image
zOadT commented 2 years ago

Hey! Bodies will be set to sleeping if they don't move for some time (this is a an optimization). This should fix it:

setInterval(() => {
  ball.setPosition(new Vec2(0, 4));
  ball.setAwake(true);
}, 4000)
theajack commented 2 years ago

Thanks