Releases: pmndrs/react-three-rapier
Releases · pmndrs/react-three-rapier
@react-three/[email protected]
@react-three/[email protected]
Major Changes
-
6c764cc: Remove WorldApi, replace with singleton instance proxy (@wiledal)
BREAKING CHANGE: The WorldApi has been removed. Instead, you can now import the singleton instance of the world from @react-three/rapier. This is a breaking change, but it should be easy to migrate to.
Before:
import { useRapier } from "@react-three/rapier"; const Component = () => { const { world } = useRapier(); useEffect(() => { // Access to the WorldApi (limited) world.bodies.forEach(() => { // Do something }); // Access the raw Rapier World instance const rawWorldInstance = world.raw(); rawWorldInstance.raw().setGravity(new Vector3(0, -9.81, 0)); }, []); };
Now:
import { useRapier } from "@react-three/rapier"; const Component = () => { const { world } = useRapier(); useEffect(() => { // Access the Rapier World instance directly world.bodies.forEach(() => { // Do something }); world.setGravity(new Vector3(0, -9.81, 0)); }, []); };
Note: it is best to avoid accessing properties and methods on the world outside of
useEffect
, oruseLayoutEffect
in order for the world to be properly synchronized with the React component lifecycle.// bad const Component = () => { const {world} = useRapier() world.setGravity(...) return null } // good const Component = () => { const {world} = useRapier() useEffect(() => { world.setGravity(...) }, []) return null }
@react-three/[email protected]
Patch Changes
- Updated dependencies [6c764cc]
- @react-three/[email protected]
@react-three/[email protected]
@react-three/[email protected]
Patch Changes
- Updated dependencies [93c7e8c]
- Updated dependencies [c4d2446]
- Updated dependencies [c4d2446]
- @react-three/[email protected]
@react-three/[email protected]
@react-three/[email protected]
Patch Changes
- 35ee03b: Loosen peer deps in attempt to solve npm install conflicts
@react-three/[email protected]
Patch Changes
- 35ee03b: Loosen peer deps in attempt to solve npm install conflicts
- Updated dependencies [35ee03b]
- @react-three/[email protected]
@react-three/[email protected]
Minor Changes
@react-three/[email protected]
Major Changes
- 3d8f152: Move
<Attractor />
to @react-three/rapier-addons
Patch Changes
- 97d82c5: Fix broken imports from source instead of package
- Updated dependencies [3d8f152]
- Updated dependencies [3d8f152]
- @react-three/[email protected]