hey
I am trying to figure out why my ray cast transform.forward is always going to global transform vector 0,0,0
well thats what the debug.drawline seems to be representing.
sorry if blue line hard to see
heres my code:
Ray ray = new Ray (transform.position, transform.forward);
RaycastHit hit;
float distanceToPlayer;
if (Physics.Raycast (ray.origin, ray.direction, out hit))
{
Debug.DrawLine (ray.origin, transform.forward, Color.blue);
transform.LookAt (player.position + transform.up);
//Debug.DrawLine (ray.origin, player.position, Color.green);
Debug.DrawLine (ray.origin, player.position, Color.white);
distanceToPlayer = hit.distance;
Debug.Log (distanceToPlayer);
}
The rest of it works well… and it seems to be the way everyone else is doing it, so can someone please explain?
Thanks