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, 2012 at 01:35 AM

AJspartan gravatar image

AJspartan
16 13 10 11

(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, 2012 at 02:54 AM

alucardj gravatar image

alucardj
29.3k 166 1038 198

(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:

x4184
x3572
x2934
x572
x288

asked: Apr 03, 2012 at 01:35 AM

Seen: 2166 times

Last Updated: Nov 09, 2012 at 05:26 AM