Closed Glavin001 closed 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
@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!
@bjornstar Ready for final review 🎉
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?
@bjornstar : Pushed new demo/example and other fixes based on your feedback above. Ready for review again. Thanks!
Cool, I think this turned out quite well. Thanks for the contribution!
Released in v4.5.0
Thanks for merging, @bjornstar !
Next up is https://github.com/pmndrs/use-cannon/pull/317#issuecomment-1007876203 All ready for you 🙂🎉
Add maxMultipler threshold to constraints.
Inspired by https://github.com/pmndrs/cannon-es/blob/6f11e268d5e196f7f4f5908dbf60ae6365bd6ab6/examples/tear.html
maxMultiplier
option to all constraints, which disables constraint when threshold is exceededpostStep
listener ifmaxMultiplier
set / notundefined
Chain
)maxMultiplier
values0 = blue
/easily break,1500 = red
/harder to break,white = undefined
/won't break)Demo
https://use-cannon-git-fork-glavin001-feat-constraint-max-e97738-pmndrs.vercel.app/#/demo/Chain
Initially:
After breaking some chain constraints: