2D Toolkit Forum

2D Toolkit => Support => Topic started by: JBabz on July 30, 2013, 06:45:34 pm

Title: [2.1] How to get character to always look at mouse
Post by: JBabz 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. :)
Title: Re: [2.1] How to get character to always look at mouse
Post by: unikronsoftware 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.