Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void OnDrawGizmos()
- {
- Vector3 origin = transform.position;
- Vector3 direction = transform.forward * range;
- if (Physics.Raycast(origin, direction, out hit, range))
- {
- Gizmos.color = Color.green;
- Gizmos.DrawLine(origin, hit.point);
- Gizmos.DrawSphere(hit.point + Vector3.up* 0.1f, 0.5f);
- }
- else
- {
- Gizmos.color = Color.red;
- Gizmos.DrawLine(origin, origin + direction);
- Gizmos.DrawSphere(origin + direction, 0.5f);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement