-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extending Physx API Bindings - exploration of options. #15
Comments
Wow thanks for this writeup and sharing this repo! https://github.com/fabmax/physx-js-webidl
|
Sorry to write on this thread 1 year after last communications, but it would be nice to have Physx migrated to physx-js-webidl because it have support for vehicles and this is a big point, useful for a-frame + physx. |
I got it to build with the trzeci/emscripten:1.39.5-upstream docker image, without your commit
With your commit I got an error:
Without your commit:
http://localhost:8080/examples/basic/ Uncaught (in promise) RuntimeError: abort(LinkError: WebAssembly.instantiate(): Import #48 "env" "memory": memory import has no maximum limit, expected at most 4294967295) at Error |
Comparing the current and new physx.release.js, it seems that the current physx.release.js we have was build with a later version than emscripten:1.39.5, it's using the newer INITIAL_MEMORY instead of the deprecated TOTAL_MEMORY |
I'm still testing some versions. I tested also with the official docker image diff --git a/generate.sh b/generate.sh
index 0e39d36..268cf84 100755
--- a/generate.sh
+++ b/generate.sh
@@ -1,4 +1,7 @@
#!/bin/bash
cd ./PhysX/physx
-./generate_projects.sh emscripten
\ No newline at end of file
+apt-get update
+apt-get -y install python3
+ln -s /usr/bin/python3 /usr/bin/python
+./generate_projects.sh emscripten
diff --git a/make.sh b/make.sh
index 993710a..dbd2f4e 100755
--- a/make.sh
+++ b/make.sh
@@ -1,7 +1,8 @@
#!/bin/bash
+set -e
cd PhysX/physx/compiler/emscripten-release/
make
-mkdir -p /src/lib
+mkdir -p /src/dist
cp /src/PhysX/physx/bin/emscripten/release/physx.release.js /src/dist/physx.release.js
cp /src/PhysX/physx/bin/emscripten/release/physx.release.wasm /src/dist/physx.release.wasm The latest version of emscripten / clang is more strict with the cpp code, instead of fixing the cpp code, I ended up adding a bunch of flags I'm trying old emscripten versions with the deprecated trzeci/emscripten image and first trying to reproduce the build we currently have. To reproduce the memory maximum, I had to set |
Zachary definitely used at least trzeci/emscripten:1.39.17-upstream because we have that change |
Oh! With https://github.com/zach-capalbo/PhysX/commits/emscripten_wip/ without the last commit TriMesh bindings, it works! |
Rebasing from nvidia 4.1 branch also produces "Uncaught (in promise) RuntimeError: null function or function signature mismatch" so I gave up on that rebase. I forked the two repos in c-frame |
If you're testing locally a build, be sure to put back in I was testing with the wasm file from the cdn this whole time. No wonder that I got the "Uncaught (in promise) RuntimeError: null function or function signature mismatch" error. TT |
Okay so the latest commit from Zach about TriMesh bindings is actually working. I force pushed the branch to revert my revert. I merged the nvidia 4.1 branch so we get the 4.1.2 changes https://nvidiagameworks.github.io/PhysX/4.1/release_notes.html and I exposed joint limit and projection tolerances in c-frame/PhysXSDK@0f6fa8b |
Impressive, @vincentfretin. As I stated in my previous message my interest is on exposing vehicle bindings for using in A-Frame. If I can help in some way, here I am. |
@enzofrancescaHM feel free to experiment exposing the bindings for that now that we have a working process to build the wasm file. Note that the vehicle api changed completely in PhysX 5.x so it may not be worth it to spend time on that with the current 4.1.2 version we use. See https://nvidia-omniverse.github.io/PhysX/physx/5.5.1/docs/MigrationTo51.html#vehicles For ammo, I did https://github.com/c-frame/aframe-racing-game to test vehicles controls if you didn't see it. |
Yeah I got the angular limit for Revolute constraint working (for the door). |
I need a second pair of eyes about the api here #25 |
yeah, I played with ammo extensively in the past, you can watch a little experiment here: https://www.youtube.com/watch?v=W6zhs0Gzy1U |
perfect, I've I'll give it a look today and test the joints |
If fixed this in #26 you just need to run |
I've been looking at extending the available PhysX API bindings.
My immediate goal was to experiment with Projection on Fixed Joints to solve a problem where walls of bricks joined together with fixed joints become wobbly above a certain size.
For future reference, this issue documents my progress on a couple of fronts.
This is the "obvious" approach, and should have been straightforward.
I made some minor updates to enable a couple of new API calls here
Rebuilding should be pretty straightforward, but I had a few issues
This is used by PHY, a Physics library for Three.js that I've been looking at.
Benefits of using this WASM build include:
I've been making some changes on this branch to try to get this working. Unfortunately it's not staightforward.
The way the PhysX CPP API gets translated into a JS API is quite different for this alternative build.
Working through the differences has basically been a matter of:
If made a bunch of fixes & hit a number of errors, but still hitting problems inside the physics simulation:
Presumably something has been initialized incorrectly due to the change in API, but it's not straightforward to find out what.
I'm wrapping up this investigation for now. While I had wanted to experiment with projection of Fixed Joints, I only thought there was a small chance of it solving my problems, and think a better solution is likely to be by following the advice in the API docs and use a single actor with multiple shapes...
Nevertheless, it's likely that we'll want to extend the exposed parts of the PhysX API and/or move to 5.1+ at some point, so with that in mind, I've documented my investigations so far here.
The text was updated successfully, but these errors were encountered: