Closed nvaytet closed 1 year ago
Sorry, no, it isn't possible to get the color. But the index in the position array should probably be possible. This is the information currently returned:
Getting the index would be super.
I would be more than happy to create a pull request with changes but would need some pointers as to where I could add this.
I am guessing it may be in the object returned by raycaster.intersectObject(root, true)
?
https://github.com/jupyter-widgets/pythreejs/blob/4c40956bb0541335273cf5a352498ac1c91bc8b4/js/src/controls/Picker.js#L108
I think you should already be able to get the index (via face
/faceIndex
I think?). I'm not sure if the problem will be any easier on the JS side.
I had tried looking at the face
and faceIndex
, but for a Points
object they seem to always be None
or zero. They don't change when I move the mouse over another point in the cloud.
I have indeed tried to replace my Points
with a Mesh
that uses a BoxGeometry
and the faceIndex
then seems to be updating with something sensible. Can it be that there are no faces in a Points
object?
Or maybe it's something to do with the fact that I am using a BufferGeometry
?
https://github.com/mrdoob/three.js/issues/5164
I think this is solved by https://github.com/jupyter-widgets/pythreejs/pull/379 . Going to close this for now (expect a release soon, and ping me if not).
Hi,
I am trying to add a hover picker on a
Points
geometry that would allow me to read the color value of the picked point (or even better the index of the picked point in the position array).Inspired from the
Picker
example (https://github.com/jupyter-widgets/pythreejs/blob/master/examples/Picker.ipynb), I manage to read the position of the points over which I am hovering. How could I read the color value without having to perform a search for the point that is closest to the current cursor position?Code example:
Many thanks for any help!