Jump to content

Eye Following Pointer


Kerryb3d
 Share

Recommended Posts

Hello, I'm currently trying to do a simple eye movement that follows the pointer.   Setting the pupil to track the pointer is easy enough, but I can't seem to find the best way to keep the pupil inside the bounds of the eye, while respecting the curvature of the eye.  Below is an example of the eye shape.

 

post-10043-0-39197000-1407515310.jpg

 

Any input would be greatly appreciated! Thank You.

 

Link to comment
Share on other sites

Do the eyes need to be oval shaped?

 

Maybe it's better to keep it simple and have the eyes be circle shaped. Alternatively, you could have the eyes any shape but still have the pupils only move in a perfect circle within the confines of the eyes.

Link to comment
Share on other sites

The way I'd do this is cheat. I'd make this circular and put the pupil as a child of the eyeball sprite, then borrow from any number of tutorials or existing examples of this type of effect. Then I'd set the x scale of the whole sprite to 0.75 or so, and rotate it -20 degrees. The pupil will take on the same distortion as the eyeball, but I think that's a small price to pay compared to the maths involved in constraining something to a rotated oval shape ;)

Link to comment
Share on other sites

  • 1 year later...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...