threlte
threlte copied to clipboard
feature(rapier): add Attractor component
UPDATE: I managed to get predictable positioning (i.e. if the <Attractor />
is a child, it will position relative to its parent) and it works as a rigid-body to simulate gravitational interactions. Dynamic range and strength also works as you'd expect.
I'm not sure if I implemented these properly, so let me know. I spent a lot of time with trait components but didn't really understand everything I was reading.
I added the showHelper
prop because I think it's useful and convenient, but would be simple to implement by users, so happy to remove it.
Open to all feedback!
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Updated |
---|---|---|---|
threlte | ✅ Ready (Inspect) | Visit Preview | Oct 18, 2022 at 3:28AM (UTC) |
Updated with two additional props gravityType
and gravitationalConstant
Using realistic gravity was annoying, and I don't think what most people would want so I didn't want that to be the only option. I added descriptions of each type and a controlled example ("Advanced") to the md file! Let me know if it's confusing or needs more work.
Ah and please add a changeset: run npx changeset
from the repo root 👍
- Cleaned up the imports and exports
- Took a shot at the changeset. Did a minor bump for
/docs
and/rapier
and left a short summary but wasn't totally sure how to do all that! Let me know if it needs edits and I'll modify it
Amazing, thank you!