Skip to content

Organising constraints #141

Answered by mattrossman
onion2k asked this question in General
Discussion options

You must be logged in to vote

It's possible to use forwardRef (see below, I moved useSphere into ball.js), but there seems to be some timing bug where it sets up the constraint before the ref is set. I've added a small timeout before setting up the constraint, which works but I wouldn't trust:
https://codesandbox.io/s/usecannon-constraints-forked-qp0dg

Maybe if you set up a custom ref callback you can solve the timing in a more reliable way. But ultimately this seems like an issue with use-cannon.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by onion2k
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants