- Home /
Raycast not drawing
Hey guys. I'm trying to dig my way into raycasting and I'm having a hard time drawing it for debugging.
Currently the ray works the way intended, but it doesn't draw it with Debug.DrawRay. here is my code:
public Vector3 charFeet = new Vector3(0,1,0); public Vector3 below; public Color rayColor;
void Start(){ below = transform.position-charFeet; }
void Update(){ if(Physics.Raycast(transform.position, below, 10)) { rayColor = Color.green; } else { rayColor= Color.red; }
Debug.DrawRay(transform.position, below, rayColor);
}
I have that script assigned for my player character. The rayColor is changing depending if there is a object below the character, but the ray isn't drawn.
Thanks in advance.
Answer by Ashkan_gc · Mar 14, 2011 at 11:48 AM
select the "gizmo" button in gameview and it will be drawn.
You are my hero. :) Thanks, I knew it was something like that. Tried to find that from the settings :P