pmndrs / use-cannon

👋💣 physics based hooks for @react-three/fiber

Home Page:https://cannon.pmnd.rs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Replace useEffect with useLayoutEffect

alexandernanberg opened this issue · comments

useEffect wont run before rendering the scene, so there is a flash of content without physics. This is particularly visible when using useRaycastVehicle (wheels have wrong placement/rotation for a second).

Is there a reason to not use useLayoutEffect instead? If not I can create a PR

commented

where? i thought its already using uLE. go ahead and then let's review the pr.

hmm replaced all uE with uLE locally and saw the same issue, plus that other things broke. So not related I guess, will keep investigating a bit but closing this issue