Hi, guys. I need your help.
I have one game object and a point on space that I got from a Ray casted from the main camera. I tried very hard to make this object aim to that point just in the forward axis, like a Sidescroller shooter, where the mouse pointer is the aim of the gun (up and down only). I tryed everything but something is wrong… please advise.
void Update () {
if(Physics.Raycast(camera.ScreenPointToRay(Input.mousePosition),out hit, 100))
{
targetLook = hit.point;
//now i need to make my object aim to the targetLook, but only on the forward axis.
//I tryed using Atan2, that I usually do with Flash based games, but in 2D Space..
}
}
Appreciate any help!