I was trying to know if an object is grounded or not and I was using RayCast to do it:-
float minimum_distance_from_ground = 0.1f;
Ray ray = new Ray(transform.position, Vector3.down);
RaycastHit hit_info;
bool hashit = Physics.Raycast(ray, out hit_info, transform.localScale.x + minimum_distance_from_ground);
print(hashit);
It prints true when it is supposed to, but it hat issues so I decided to switch to SphereCast:-
float minimum_distance_from_ground = 0.1f;
Ray ray = new Ray(transform.position, Vector3.down);
RaycastHit hit_info;
bool hashit = Physics.Raycast(ray, out hit_info, transform.localScale.x + minimum_distance_from_ground);
print(hashit);
But now it isn’t working.
Can someone point out where the issue is?