c-frame / aframe-physics-system

community-maintained fork of n5ro's aframe-physics-system
https://c-frame.github.io/aframe-physics-system/
MIT License
43 stars 11 forks source link

Cannot disable gravity on the system with ammo driver #36

Closed mikemainguy closed 1 year ago

mikemainguy commented 1 year ago

Attempting to enable phsyics with no gravity. Setting gravity: 0 on system doesn't disable.

https://zest-glaze-settee.glitch.me/

diarmidmackenzie commented 1 year ago

Had a look at this. The documentation describes gravity config on both the physics system level and a per-object level.

Unfortunately it doesn't really work, as the object schema sets a default per-object gravity at "0 -9.8 0".

So even if you set the system gravity to something else (e.g. "0 0 0") every object will still be created with gravity of "0 -9.8 0" unless you explicitly set it to have a different gravity.

As far as I can tell, this renders the system-level gravity setting completely useless.

It would probably be a better interface if per-body gravty defaulted to system gravity, rather than "0 -9.8 0". That's an interface change, but I'd be surprised if anyone relies on the fact that default body gravity is "0 -9.8 0" even when system gravity is set to some other value...

In the meantime, if you want zero gravity physics simulations, the best way is to explicitly set "gravity: 0 0 0" on each ammo-body.

diarmidmackenzie commented 1 year ago

PR #38 will solve this