I have a top down view. I’m trying to cast a ray one unit away from the player in the direction they are facing. But instead of the ray going forward it is going to a seemingly random point in toward the middle of the screen. And said point moves on direction keydowns some times.
function Update (){
var direction = transform.TransformDirection(Vector3.forward);
var hit : RaycastHit;
if (Physics.Raycast (this.transform.position, direction, hit, 1)) //cast ray
{
print("HIT");
}
Debug.DrawLine (this.transform.position, direction, Color.white);
}
And ahead of time, Thanks for any help. ![]()