n5ro / aframe-physics-system

Physics system for A-Frame VR, built on CANNON.js.
https://n5ro.github.io/aframe-physics-system/
MIT License
507 stars 137 forks source link

New ammo version not working #130

Closed elbobo closed 5 years ago

elbobo commented 5 years ago

Hi,

Great to see the new ammo version added to this, I don't seem to be able to get it working however. Please see below a minimum example..

Using the following scripts;

    <script src="https://aframe.io/releases/0.9.2/aframe.min.js"></script>
    <script src="https://mixedreality.mozilla.org/ammo.js/builds/ammo.wasm.js"></script>
    <script src="https://cdn.rawgit.com/donmccurdy/aframe-physics-system/v3.3.0/dist/aframe-physics-system.min.js"></script>

Then creating a scene as follows

<a-scene physics=" driver: ammo; debug: true; debugDrawMode: 1;">

      <a-box 
        position="0 4 -4"
        color="red"
        ammo-body="type: dynamic"
        ammo-shape="type: box">
      </a-box>

      <a-box 
        width="20" 
        height="0.2" 
        depth="20"
        color="blue"
        ammo-body="type: static"
        ammo-shape="type: box">
      </a-box>

</a-scene>

The physics does not work and I get the following error in the console

Uncaught Error: [physics] Driver not recognized: "%s".

Am I missing something?

Thanks

chrisnovello commented 5 years ago

Looks like the cdn isn't updated yet / needs a new distribution. If you want to tinker in the meantime, clone this repo, then run

npm install
browserify index.js -o aframe-physics-system.js

Could also just use this unminified build I have up if you want to test.. but prob better to build your own or wait

<script src="https://ammo-physics.glitch.me/aframe-physics-system-ammo-build.js"></script>

InfiniteLee commented 5 years ago

@paperkettle is correct, we haven't pushed a new version number of aframe-physics-system yet. My suggestion is to point to the master branch npm install github://donmccurdy/aframe-physics-system#master.

josros commented 5 years ago

I could get it running using:

https://github.com/donmccurdy/aframe-physics-system.git#master and the script import: <script src="https://mixedreality.mozilla.org/ammo.js/builds/ammo.wasm.js"></script>

(The ammo driver was implemented with: https://github.com/donmccurdy/aframe-physics-system/commit/60b907f4268973eec25e90541c5206847f9e3674#diff-05503c775750f9f2c0cdfb6a786618ec and is therefore not included in v3.3.0)

However, I couldn't find a way to include the ammo driver as described in section: npm-and-webpack using the following dependencies:

"aframe": "^0.9.2",
"aframe-physics-system": "git+https://github.com/donmccurdy/aframe-physics-system.git#master",
"ammo.js": "git+https://github.com/MozillaReality/ammo.js.git#master"

The ammo physics world instance seems not to have the function: this.physicsWorld.setForceUpdateAllAabbs(false)

Also tried with kripken which resulted in the same error.

donmccurdy commented 5 years ago

4.0.0 is out!

hayden2114 commented 4 years ago

I'm using the updated (17 days ago) version of ammo.js at (http://kripken.github.io/ammo.js/builds/ammo.wasm.js) and I'm getting the error TypeError: this.physicsWorld.setForceUpdateAllAabbs is not a function coming from https://cdn.rawgit.com/donmccurdy/aframe-physics-system/v4.0.1/dist/aframe-physics-system.min.js

If I use https://mixedreality.mozilla.org/ammo.js/builds/ammo.wasm.js I don't get that error but I get another error related to btRaycastVehicle not being a constructor. I'm guessing the mozilla build doesn't port over those functions.

Any help would be much appreciated and I'm happy to provide more code for context if needed!

hayden2114 commented 4 years ago

Creating an issue for this as well since I'm not sure if you're notified on a closed issue