Skip to content

Instantly share code, notes, and snippets.

@FCkaisei
Created May 15, 2016 22:09
Show Gist options
  • Save FCkaisei/04ee0a660f864da4863c6518df50fdd5 to your computer and use it in GitHub Desktop.
Save FCkaisei/04ee0a660f864da4863c6518df50fdd5 to your computer and use it in GitHub Desktop.
C#
using UnityEngine;
using System.Collections;
public class raySet : MonoBehaviour {
float y;
void FixedUpdate ()
{
Vector3 fwd = transform.TransformDirection (Vector3.forward * 10);
Debug.DrawRay (transform.position, fwd, Color.blue, 0.1f);
if (Physics.Raycast (transform.position, fwd, 200)) {
print ("There is something in front of the object!");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment