diff --git a/demo/src/examples/joints/JointsExample.tsx b/demo/src/examples/joints/JointsExample.tsx index 1692b860..1e593bb6 100644 --- a/demo/src/examples/joints/JointsExample.tsx +++ b/demo/src/examples/joints/JointsExample.tsx @@ -59,9 +59,12 @@ const Rope = (props: { component: ReactNode; length: number }) => { useFrame(() => { const now = performance.now(); - refs.current[0].current!.setNextKinematicRotation( - new Quaternion(0, Math.sin(now / 500) * 3, 0) - ); + const ref = refs.current[0].current; + if (ref) { + ref.setNextKinematicRotation( + new Quaternion(0, Math.sin(now / 500) * 3, 0) + ); + } }); return (