3D object picker for Makie or other visualization package

I noticed that Makie has 2D picking and mouse click screen to world coordinates transform:

  on(scene.events.mousebuttons) do buttons
    if ispressed(scene, Mouse.left)
      pos = to_world(scene, Point2f0(scene.events.mouseposition[]))

When I try it inside a 3D scene, pos doesn’t seem to have any correspondence with world coordinates. Is there anything available for picking in 3D visualizations with Makie or another package?

1 Like

not sure if makie has it built in. Back in the OpenGL days I used to do this by: mouse to world coords( Sometimes that vector rotation is done via quaternerions depending on users ability to do pitch, roll and yaw) then an infinite (or max world length) vector checking for nearest intersections with basic vector stuff. Spheres were easiest but you could also do mesh picking, I bet the #geometry crew would be up for it.


I wanted this at some point, but the problem is that you only have a 2D view, so how do you specify 3D coordinates?

You project 3D world onto 2D screen, specify a 3D ray intersecting transformed mouse coordinates and calculate, which object is closest to it or some other metric favoring objects closer to the camera.

1 Like