Skip to content

Commit

Permalink
examples: fix hit test anchor example reading points out of the list
Browse files Browse the repository at this point in the history
  • Loading branch information
bbohlender committed Aug 30, 2024
1 parent 51d88ab commit 8f49bc6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion examples/hit-test-anchor/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
useXRRequestHitTest,
useXRAnchor,
useXRInputSourceStateContext,
useXRInputSourceState,
} from '@react-three/xr'
import { useEffect, useRef } from 'react'
import { Matrix4, Mesh, Vector3 } from 'three'
Expand Down Expand Up @@ -127,6 +126,9 @@ function Point({ index, left }: { left?: boolean; index: number }) {
useEffect(
() =>
(left ? useLeftPoints : useRightPoints).subscribe((state) => {
if (index >= state.length) {
return
}
ref.current!.position.copy(state[index])
}),
[index, left],
Expand Down

0 comments on commit 8f49bc6

Please sign in to comment.