Make only eyes move with (look at) the mouse cursor

Greetings again!
I would like to make eyes look at the mouse cursor. (not the whole head or eyes but only eye pupils)

Like this example:

Should I modify the existing model and add two eye objects in it?
Or maybe can I add two planes for those eyes in the code and make them look at the mouse?

If someone can give me sample code’s url, that would be much appreciated.
Thank you in advance.

Funky tracking eyeballs from stratch :slight_smile:


Thank you so much, @prisoner849
This code was really helpful.
I placed your eyes on the model.

But as you can see, that is awkward…but I can’t figure out what to change.

if possible, could you please update the code in here?

Thank you again for your time.

FYI, I don’t need awesome eyes like your profile picture. :sweat_smile:
I would like to make it work like this.

In the reference with animation, I belive, that those eyeballs are spheres, so it’s easier to make them tracking with lookAt.

Made another demo, forked from my previous codepen:

Your model has eyeballs, kind of squeezed on Z-axis, so the method with simply lookAt is not suitable in this case :thinking:

Maybe the raycasting from the point on a plane to centers of eyeballs is worth a try. Getting a point of intersection on an eyeball, move the mesh of a pupil (a sphere, for example) to this point. :thinking:


Thank you @prisoner849
You are really awesome! :star_struck: :star_struck: :star_struck:

1 Like