x


Before updating to Windows 10 you may need to return your Pro license. More information here

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

avatar image

AJspartan
16 13 10 12

(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

avatar image

alucardj
31.2k 172 1072 243

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

x4979
x4332
x3542
x708
x347

asked: Apr 03, 2012 at 01:35 AM

Seen: 2322 times

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