- Home /
Question by
AJspartan · Apr 03, 2012 at 01:35 AM ·
collisiongameobjectcolliderontriggerenterdetection
Collision Checking
How do i check for collision without using OnTriggerEnter or OnTriggerExit, because these are only checking collision with moving objects inside their colliders for some reason. Is there anyother way to check for collision with specific gameObjects that are not moving and are already inside a collider?
Comment
Best Answer
Answer by AlucardJay · Apr 03, 2012 at 02:54 AM
this might help : Returns an array with all colliders touching or inside the sphere.
http://unity3d.com/support/documentation/ScriptReference/Physics.OverlapSphere.html
example :
var radius : float = 2.5;
var objectsInRange : Collider[] = Physics.OverlapSphere(transform.position, radius);
for (var object : Collider in objectsInRange)
{
print (object.name);
}