x


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?

more ▼

asked Apr 03 '12 at 01:35 AM

AJspartan gravatar image

AJspartan
16 5 5 6

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

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);
}
more ▼

answered Apr 03 '12 at 02:54 AM

alucardj gravatar image

alucardj
25.6k 63 73 113

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3657
x3062
x2511
x493
x249

asked: Apr 03 '12 at 01:35 AM

Seen: 1769 times

Last Updated: Nov 09 '12 at 05:26 AM