c-frame / aframe-physics-system

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

Vehicle physics with ammo #53

Open vincentfretin opened 10 months ago

vincentfretin commented 10 months ago

I started using ammo vehicle physics in aframe directly from https://github.com/kripken/ammo.js but not using aframe-physics-system in this experiment https://github.com/c-frame/aframe-racing-game I didn't think yet how to use it with an existing scene with aframe-physics-system ammo. For now I just did a simple conversion in an aframe component of the kripken's demo. If someone have any thought about it, they can contribute to the discussion.

FYI the MozillaReality ammo build we use in the examples in aframe-physics-system doesn't have vehicle physics. You need the latest build from kripken's repo https://cdn.jsdelivr.net/gh/kripken/ammo.js@8f8b7187ef74994093318645e5e96b11d982688a/builds/ammo.wasm.js I have no idea if there is incompatibilities or not using the latest build with aframe-physics-system.

enzofrancescaHM commented 3 months ago

I managed to mix an existing scene with a vehicle example, everything works properly if using the wasm you provided, but there is an error complaining of the lack of the function setForceUpdateAllAabbs(). I've commented out the only line using that in the aframe-physics-system and now it is ok, but I don't understand why this error, maybe this is related to https://github.com/n5ro/aframe-physics-system/issues/130

vincentfretin commented 3 months ago

setForceUpdateAllAabbs is indeed in https://cdn.jsdelivr.net/gh/MozillaReality/ammo.js@8bbc0ea/builds/ammo.wasm.js but not in the latest build https://cdn.jsdelivr.net/gh/kripken/ammo.js@8f8b7187ef74994093318645e5e96b11d982688a/builds/ammo.wasm.js In https://github.com/kripken/ammo.js/blob/1ed8b58c7058a5f697f2642ceef8ee20fdd55e10/bullet/src/BulletCollision/CollisionDispatch/btCollisionWorld.h#L515 setForceUpdateAllAabbs seems to still exists there but not sure what are exposed in the wasm build from that file and what changed between the mozilla build and the latest kripken build.