-
-
Save Gojeflone/9043685 to your computer and use it in GitHub Desktop.
Finding the distance between two points in 3D
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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