troisjs / trois

✨ ThreeJS + VueJS 3 + ViteJS ⚡

Home Page:https://troisjs.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

onClick for Object3D Line

reinzor opened this issue · comments

Hi,

I am trying to add support for rendering a line using the Object3D component:

<template>
  <object3-d ref="element" />
</template>
const material = new LineBasicMaterial({
  color: 0x000000,
  linewidth: 2,
});

onMounted(() => {
  if (element.value !== null) {
    element.value.initObject3D(new Line(someBufferedGeometry, material));
  }
});

However, when I try to register an onClick event on the Object3D it does not work properly. It returns a lot of objects that are not positioned at the pointer. In a Threejs example, I see they are setting a parameter raycaster.params.Line.threshold, is this required?

Could you give some guidance in how to implement a Line as an Object3D? I am happy to send a PR but need some guidance regarding the implementation. Thanks!

No response by author, abandoning issue