Skip to content

Releases: pmndrs/react-three-rapier

@react-three/[email protected]

05 Dec 20:43
6b0345d
Compare
Choose a tag to compare

Patch Changes

  • a71ede9: Update changeset settings

@react-three/[email protected]

17 Oct 07:40
6703cd5
Compare
Choose a tag to compare

Patch Changes

@react-three/[email protected]

17 Oct 07:40
6703cd5
Compare
Choose a tag to compare

Patch Changes

@react-three/[email protected]

19 Jun 19:35
f3fbd8f
Compare
Choose a tag to compare

Patch Changes

@react-three/[email protected]

19 Jun 16:44
d5a5fb9
Compare
Choose a tag to compare

Minor Changes

@react-three/[email protected]

19 Jun 19:35
f3fbd8f
Compare
Choose a tag to compare

Patch Changes

@react-three/[email protected]

19 Jun 16:44
d5a5fb9
Compare
Choose a tag to compare

Minor Changes

Patch Changes

@react-three/[email protected]

01 Jun 07:03
867973b
Compare
Choose a tag to compare

Patch Changes

@react-three/[email protected]

01 Jun 07:03
867973b
Compare
Choose a tag to compare

Patch Changes

@react-three/[email protected]

21 May 18:20
062b5c4
Compare
Choose a tag to compare

Major Changes

  • 6c764cc: Remove WorldApi, replace with singleton instance proxy (@wiledal)

    BREAKING CHANGE: The WorldApi has been removed. Instead, you can now get a proxied 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.raw().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 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
    }

Minor Changes

Patch Changes

  • 3057f3c: Fix initiation to only happen in mount effects, never render, for increased stability (@wiledal)
  • c4d2446: Internal refactor regarding instances (@wiledal)