Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add scaleOverride to useBody props #374

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

krispya
Copy link
Member

@krispya krispya commented Apr 17, 2022

Makes it so you can specifyscaleOverride in the uesBody props. Since most use cases I have for this initialize the scale on mount and then don't touch it, this method ends up being more compact and also lets me use the same scale factor in the body easily. For example:

const [ref, { at }] = useBox(() => {
    const scale = randomInRange(0.65, 1.2)
    return {
      args: [size * scale, size * scale, size * scale],
      mass: 1,
      position: [Math.random() - 0.5, Math.random() * 2, Math.random() - 0.5],
      scaleOverride: [scale, scale, scale],
    }
  })

@vercel
Copy link

vercel bot commented Apr 17, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
use-cannon ✅ Ready (Inspect) Visit Preview Apr 18, 2022 at 2:58AM (UTC)

@krispya
Copy link
Member Author

krispya commented Apr 18, 2022

I realized I was putting the type in the wrong place. I moved it to the hook and out of the worker.

@isaac-mason isaac-mason requested a review from bjornstar May 3, 2022 04:17
@bjornstar
Copy link
Member

Please resolve merge conflicts.

Also, this doesn't work because the scaleOverride is not being passed to useBody.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants