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

**URL:** <https://discourse.threejs.org/t/make-only-eyes-move-with-look-at-the-mouse-cursor/61166>\
**Category:** Questions\
**Tags:** mousemove, animation\
**Created:** [February 6, 2024, 12:35pm UTC](https://discourse.threejs.org/t/make-only-eyes-move-with-look-at-the-mouse-cursor/61166 "2024-02-06T12:35:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jason](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/jason/32/44484_2.png) [@Jason](https://discourse.threejs.org/u/Jason)\
**Post date:** [February 6, 2024, 12:35pm UTC](https://discourse.threejs.org/t/make-only-eyes-move-with-look-at-the-mouse-cursor/61166/1 "2024-02-06T12:35:14Z")

</div>

Greetings again!  
I would like to make eyes look at the mouse cursor. (not the whole head or eyes but only eye pupils)  
 ![](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/1/9/1968ec94bde7fb4beb8deb60db8233a15dc58dbe.jpeg)  
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.

---

<div class="post-metadata">

**Author:** ![prisoner849](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/prisoner849/32/535_2.png) [@prisoner849](https://discourse.threejs.org/u/prisoner849)\
**Post date:** [February 6, 2024, 1:52pm UTC](https://discourse.threejs.org/t/make-only-eyes-move-with-look-at-the-mouse-cursor/61166/2 "2024-02-06T13:52:00Z")

</div>

Funky tracking eyeballs from stratch 🙂

https://codepen.io/prisoner849/embed/preview/oNVyKZY?default-tabs=js%2Cresult&height=300&host=https%3A%2F%2Fcodepen.io&slug-hash=oNVyKZY

---

<div class="post-metadata">

**Author:** ![Jason](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/jason/32/44484_2.png) [@Jason](https://discourse.threejs.org/u/Jason)\
**Post date:** [February 6, 2024, 6:10pm UTC](https://discourse.threejs.org/t/make-only-eyes-move-with-look-at-the-mouse-cursor/61166/3 "2024-02-06T18:10:42Z")

</div>

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

[https://three-tutorial-bice.vercel.app/](https://three-tutorial-bice.vercel.app/)

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?

> **[GitHub - opensea712/three-tutorial](https://github.com/opensea712/three-tutorial)**
>
> Contribute to opensea712/three-tutorial development by creating an account on GitHub.

Thank you again for your time.

---

<div class="post-metadata">

**Author:** ![Jason](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/jason/32/44484_2.png) [@Jason](https://discourse.threejs.org/u/Jason)\
**Post date:** [February 6, 2024, 6:13pm UTC](https://discourse.threejs.org/t/make-only-eyes-move-with-look-at-the-mouse-cursor/61166/4 "2024-02-06T18:13:35Z")

</div>

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

[https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/7/1/718e295d8c520d157db058b931e8850d19afa084.mp4](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/7/1/718e295d8c520d157db058b931e8850d19afa084.mp4)

---

<div class="post-metadata">

**Author:** ![prisoner849](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/prisoner849/32/535_2.png) [@prisoner849](https://discourse.threejs.org/u/prisoner849)\
**Post date:** [February 6, 2024, 8:29pm UTC](https://discourse.threejs.org/t/make-only-eyes-move-with-look-at-the-mouse-cursor/61166/5 "2024-02-06T20:29:17Z")

</div>

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: [https://codepen.io/prisoner849/full/vYPaOaP](https://codepen.io/prisoner849/full/vYPaOaP)

 ![изображение](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/b/2/b2d12279dce9fcb76a7f2ce291504840cb536c24.png)

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

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. 🤔

---

<div class="post-metadata">

**Author:** ![Jason](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/jason/32/44484_2.png) [@Jason](https://discourse.threejs.org/u/Jason)\
**Post date:** [February 6, 2024, 9:17pm UTC](https://discourse.threejs.org/t/make-only-eyes-move-with-look-at-the-mouse-cursor/61166/6 "2024-02-06T21:17:40Z")

</div>

Thank you @prisoner849  
You are really awesome! 🤩 🤩 🤩
