threlte icon indicating copy to clipboard operation
threlte copied to clipboard

feature(rapier): add Attractor component

Open AlexWarnes opened this issue 2 years ago • 2 comments

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!

AlexWarnes avatar Sep 13 '22 17:09 AlexWarnes

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)

vercel[bot] avatar Sep 13 '22 17:09 vercel[bot]

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.

AlexWarnes avatar Sep 16 '22 06:09 AlexWarnes

Ah and please add a changeset: run npx changeset from the repo root 👍

grischaerbe avatar Oct 17 '22 22:10 grischaerbe

  • 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

AlexWarnes avatar Oct 18 '22 03:10 AlexWarnes

Amazing, thank you!

grischaerbe avatar Oct 18 '22 08:10 grischaerbe