I’ve got this. The Debug.DrawLine() correctly draws the line, but the actual raycast appears to be behaving differently than the Line.
// This shoots a ray forward and down to make sure that the character is not going to fall down a level.
// Returns true if there is ground below in fron of the character
function testGround()
{
var hit : RaycastHit;
Debug.DrawRay(transform.position + Vector3.up, transform.forward - (Vector3.up * 1.5), Color.yellow);
if(Physics.Raycast(transform.position + Vector3.up, transform.forward - (Vector3.up), 1.5))
{
grounded = true;
}
}
Basically, my characters using this script are always setting themselves as grounded or not grounded, regardless of what terrain they are approaching.
I’m pretty sure it has something to do with my Physics.Raycast line, but hat has been one of the biggest stumbling blocks for me in learning.
Any help is appreciated!
edit used Vector3.up for both casts. Got rid of unsused hitInfo.