-
Notifications
You must be signed in to change notification settings - Fork 63
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
feat: update @dimforge/rapier3d-compat to 0.12.0 #601
Conversation
🦋 Changeset detectedLatest commit: 239019c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
2ff8e9f
to
239019c
Compare
Hey @isaac-mason - I love to see a feat already created! Springs would be very useful for a library I'm working on so I'm eager to help contribute and get r3-rapier up to date. I am going to spend some time diving into rapier.js and r3-rapier's codebase, and then pick up where you left off 👨💻 exciting times |
Hey @0xtito! If you're keen to help, there's a couple of things blocking this PR:
|
Nice sounds good, I have already cloned this draft locally and have noticed some errors/bugs. Regarding the Springs
I'll continue to look into the changes between the old and new collider and make sure we are properly setting/updating the state |
Quick update - after having no real breakthroughs on figuring out whether this was a rapier/rapier.js problem or something on our end, I decided to replicate the spring example they showed in the changelog, here, but with rapier.js. And it worked! rapierjs_springs_example_1.mp4Working with rapier.js and recreating this example has all but confirmed to me the problem is on our end (thankfully). It likely has to do with the the solver. Inside of the island solver, link, the init_and_step function has had an overhaul. (Last time this file was altered was 2 years ago, link to that commit here. Out of the whole function, I think the most significant change is the following:
Use not taking into account Why the spring is not working is an entirely other beast 😅 So here is what I am gonna be focusing on the next few days:
Sorry for the long comment, just wanted to get everything I have been doing down in one comment. If you guys have any thoughts/feedback on my analysis and approach for solving the problems, I am all ears! |
Another update Managed to get the figure out what was causing the error with the spring joints, it was just how it was being set. The order of how it is set (which is body1 vs body2) matters as well, as well as the location of where the rigidBodies are (I believe). I can do a little write up why that is tomorrow or monday, but my brain is all tapped out right now haha. Still though, it does not completely work. I am using the same exact example as the one from rapier and rapier.js since they are good baseline, but collision detection isn't working properly. The values are the exact same as the other examples, thus it seems all errors stem from the solver. I have not commited anything yet since things still seem to be somewhat incomplete, but if you guys want to see how I've implemented it I can commit it. Here is a video of the SpringsExample in action. r3-rapier_springs_example_1.movP.S - Is there a reason why for every joint hook we are converting a |
Thanks for the hard work put into this! For the tuple conversions, are you specifically referring to rows like these? There are a lot of improvements that I have been thinking of, but I haven't had time to make them a reality. I imagine a v2 where the Rapier lib can be dropped in allowing the user to use the non-compat version. And the eager initiation of imperative objects needs work to make it more compatible with other things. |
No problem @wiledal! I'm getting a much better understanding of how rapier and r3-rapier are working under the hood so its been a joy.
Yes exactly, it seems unnecessarily resource intensive to create a three.js Vector3, when all that is need to is a obj with x, y, and z props. I can try to refactor parts of the code which could instead use
I was wondering why we use the compat version. I have noticed that most downloads are from the compat version as well. Is it due to bundling errors, performance boosts, or some other reason?
can you elaborate on this? Are you referring to the |
The compat version inlines the wasm in the JavaScript bundle. This makes consuming the library easier, as consumers don't need to be using a bundler that supports importing wasm files. But there's some file size and initialisation time tradeoffs when inlining. |
That may be referring to issues like this? |
Feel free to create another draft PR and push to it as you go. I'm keen to follow along 🙂 |
Okay I will do that! I'll branch of from your initial work since you did a great job setting up the types and reflecting many of the changes from v0.11.2 to v0.12. I will try to keep the scope of the PR related the upgrade to v0.12, but @wiledal do you mind if I also commit changes regarding optimizations, as an example, like the |
People have been asking for ways to do this. In the best of worlds, the core of the library is
Yes, those, and the
I don't mind! |
Just created a new PR. The updated examples are there and it seems like everything is back to normal regarding performance :) Honestly embarrassing to admit, but one of the key parts that was causing the lag, with all components, is how the default value for |
Description
Changes
<Physics />
props per world configuration properties added and removed in 0.12.0useSpringJoint
,useRopeJoint
Checklist: