hwo to check if something is in a sphere in unity code example
Example: hwo to check if something is in a sphere in unity
public class Test : MonoBehaviour
{
public GameObject ThePlayer;
public float Radius;
void Update()
{
float dist = Vector3.Distance(ThePlayer.transform.position, transform.position);
if (dist < Radius)
{
// the player is within radius distance of this object
}
}
}