Hi there! I’ve got a question that seems to be uncovered.
The docs are straightforward in defining what is a RaycastHit.distance, but they don’t mention a thing about the values that distance can have.
What happens when there’s no impact at all? Is this value = null? And what about Mathf.Infinity Rays?
Should I check its value before trying to use it, so that I know if its float exists?
Thanks for any clarification!
it works like so `//c#
RayCastHit hit;
if(physics.raycast(transform.position,Vector3.down,out hit,Mathf.infinity)){
If(hit.distance==10){//do something
}}` so if you follow that only if it hits does it return its distance otherwise there is no hit.distance,so in essence hit.distance is null,hope this explains things for you.