Debug.DrawLine problem

Hello,

I added a Debug.DrawLine to a script I found, and it’s supposed to show me the raycast in the scene view.

However, it draws a line from the correct first position to a random one, not 10 units forward.

Any help?

#pragma strict

	function Update () {
		var fwd = transform.TransformDirection (Vector3.forward);
		Debug.DrawLine (transform.position, Vector3.forward * 10, Color.red);
		if (Physics.Raycast (transform.position, fwd, 10))
		{
			print ("There is something in front of the object!");
		}
	}

I think you meant Debug.DrawRay if you want to use a direction and you want to use the fwd you calculated (though that is just transform.forward).

   Debug.DrawRay(transform.position, transform.forward * 10, Color.red);
   if(Physics.Raycast(transform.position, transform.forward, 10))
    ...