Hello Guest

Author Topic: [2.1] How to get character to always look at mouse  (Read 4690 times)

JBabz

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 42
  • @joe_babz
    • View Profile
    • Zombit on Facebook
[2.1] How to get character to always look at mouse
« on: July 30, 2013, 06:45:34 pm »
Sorry for asking so many questions. I'm learning a lot, though.
So I'm fiddling, trying to get my character to always "face" the mouse pointer.
He is on the XZ plane, so I want Y location to be totally disregarded, this is 2D.
Any pointers?
I know that the first thing I need to do is get the mouse position as a world position using Camera.mainCamera.ScreenToWorld() or whatnot.
Then, I'm lost. :)

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: [2.1] How to get character to always look at mouse
« Reply #1 on: July 30, 2013, 10:31:21 pm »
once you have a world position, do something like this:
http://unikronsoftware.com/2dtoolkit/forum/index.php/topic,1957.msg9693.html#msg9693
swapping z for y.