Dear friends,
How to find a gameObject with in 3 meter. Please help me.
Thanks
Dear friends,
How to find a gameObject with in 3 meter. Please help me.
Thanks
Physics.CheckSphere(transform.position, 3.0);
or
if((targetGameObject.transform.position - transform.position).magnitude < 3.0) //inside!
thanks for you reply. how my player will find out the 3 meter away gameobject, there are many game objects.
Unity - Scripting API: Physics.SphereCastAll gives you all gameobjects with collider in the defined sphere. you can iterate through them and check for certain names, types, tags etc.