i want to know if my raycast doesnt colide and if it is, so if it is i want my raycast to be the same as a distance var, if not i want that distance to the same as let say 10…
i already did the part if it is colliding but i cant know if it doesnt collide…
If I understand that you want to know when a ray of a certain distance does NOT collide with something? Then it just doesn’t.
var hit : RaycastHit;
if (Physics.Raycast (transform.position, -Vector3.up, hit)) {
var distanceToGround = hit.distance;
}
else
print ("it did not hit anything");