Skip to content

character going through physics #744

Description

@pierroo

There is this random bug bothering me for months:

I am using r3f and rapier.
I have this as my Experience component

...

 useEffect(() => {
    if (!didInitRef.current) {
      didInitRef.current = true;
      preloadAllAssets(); // function to preload all my models and textures
    }
  }, []);

...
<Physics debug={false} colliders={false}>
        <ListPlayers />
         <WholeScene />
      </Physics>

I manage my collider from the WholeScene and Player component, so I have colliders={false} on my main Physics parent.

At random during launch (refreshing the page, sometimes it works, sometimes it does not), my player will fall through my scene and get stuck in it.

I purposedly give it a high y position, so that when it loads during its fall I hope the Physics has enough time to compute and "welcome" my player.
but it feels cheap / like a hack.

is there a way to make sure my scene is ready when physics starts? (if that's the issue)
or to know when physics is done so I can load my player?

I have tried everything and remains lost.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions