Skip to content

v4.0.0 - 2021-10-05

Compare
Choose a tag to compare
@bjornstar bjornstar released this 05 Oct 11:14
· 111 commits to master since this release

⚠️ There is a breaking change to the useSphere API ⚠️

Previously, the args property for useSphere was a single number, but this has caused a lot of confusion as many people expected it to be an array. We have standardized the format of the args property to be an array for all hooks.

Before v4:

useSphere((index) => ({ args: 10, mass: 10, position: [0, 0.5, 0] }))

From v4 onwards:

useSphere((index) => ({ args: [10], mass: 10, position: [0, 0.5, 0] }))

If you are calling useSphere you'll need to modify your code to use an array instead of a number. If you update to v4 and don't change, you will receive runtime errors saying: 'useSphere args must be an array`.

We have also included a bug fix for the rotation subscription API and added a quaternion API for direct access to the quaternions that Cannon is using behind the scenes.

What's Changed

  • Add quaternion API, convert from quaternion to rotation correctly by @bjornstar in #289
  • useSphere args must be an array by @bjornstar in #291
  • [Typescript] Add types for world messages (like setGravity) by @bjornstar in #282
  • Prefer CannonEvent over global Event type name by @bjornstar in #283
  • [TypeScript] Improve set and subscribe API by @bjornstar in #285

Full Changelog: v3.1.2...v4.0.0