Skip to content

Commit

Permalink
fix: add raycaster to state (#347)
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarosabu authored Jul 14, 2023
1 parent a30e669 commit c45d4c3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/composables/useRaycaster/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ interface PointerClickEventPayload {
}

export const useRaycaster = (objects: Ref<THREE.Object3D[]>) => {
const { state } = useTres()
const { state, setState } = useTres()

const canvas = computed(() => state.canvas?.value) // having a seperate computed makes useElementBounding work

Expand All @@ -25,6 +25,8 @@ export const useRaycaster = (objects: Ref<THREE.Object3D[]>) => {

const raycaster = new Raycaster()

setState('raycaster', raycaster)

const getRelativePointerPosition = ({ x, y }: { x: number; y: number }) => {
if (!canvas.value) return

Expand Down

0 comments on commit c45d4c3

Please sign in to comment.