Skip to content

Instantly share code, notes, and snippets.

@Gojeflone
Created February 17, 2014 02:28
Show Gist options
  • Save Gojeflone/9043685 to your computer and use it in GitHub Desktop.
Save Gojeflone/9043685 to your computer and use it in GitHub Desktop.
Finding the distance between two points in 3D
var box : Transform;
function Update () {
var dist : float = Vector3.Distance(box.position, transform.position);
Debug.Log(dist);
if(dist <= 10){
light.enabled = true;
}else{
light.enabled = false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment