pmndrs / use-cannon

👋💣 physics based hooks for @react-three/fiber
https://cannon.pmnd.rs
2.74k stars 153 forks source link

Add Tear constraint example #318

Closed Glavin001 closed 2 years ago

Glavin001 commented 2 years ago

Add maxMultipler threshold to constraints.

Inspired by https://github.com/pmndrs/cannon-es/blob/6f11e268d5e196f7f4f5908dbf60ae6365bd6ab6/examples/tear.html

Demo

https://use-cannon-git-fork-glavin001-feat-constraint-max-e97738-pmndrs.vercel.app/#/demo/Chain

Initially:

image

After breaking some chain constraints:

image

vercel[bot] commented 2 years ago

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/pmndrs/use-cannon/6CrKqrLJVz6F8vK9yBxS1wtGiUBC
✅ Preview: https://use-cannon-git-fork-glavin001-feat-constraint-max-e97738-pmndrs.vercel.app

Glavin001 commented 2 years ago

@bjornstar : I've commented on the code above with questions I'd appreciate your feedback on so I can implement it in a way you're happy with. Hope this helps. Thanks!

Glavin001 commented 2 years ago

@bjornstar Ready for final review 🎉

bjornstar commented 2 years ago

I'd really prefer not to have cross dependencies between demos. The hallmark of demos is that they are a single file that demonstrate a feature. We should be able to take that file put it in a sandbox with minimal setup.

If the two are so similar that they share files, they should be in the same file with some form of interaction. Can we drag one chain through several other chains that tear? How about clicking to reset the torn chains?

Glavin001 commented 2 years ago

@bjornstar : Pushed new demo/example and other fixes based on your feedback above. Ready for review again. Thanks!

bjornstar commented 2 years ago

Cool, I think this turned out quite well. Thanks for the contribution!

bjornstar commented 2 years ago

Released in v4.5.0

Glavin001 commented 2 years ago

Thanks for merging, @bjornstar !

Next up is https://github.com/pmndrs/use-cannon/pull/317#issuecomment-1007876203 All ready for you 🙂🎉