Using OrbitControls to follow object with cursor position

Hey y’all - been stuck on something this afternoon. Playing around with this pen, I’m trying to figure out how to leverage OrbitControls to have the object “face” the cursor based on xy position. Any help is super appreciated as I’ve only started learning three a couple weeks ago.

I would probably do it this way.

  • Add an invisible plane mesh to the scene. It should have the same dimensions an orientation like the picture.
  • Raycast against the plane mesh. Some of the code from webgl_interactive_cubes can be reused for this.
  • If there is an intersection, copy the intersection point to can call OrbitControls.update().