x


Physics.SphereCastAll with triggers

Hey Everyone. Thank you for reading my question.

I am trying to use Physics.SphereCastAll with trigger colliders and I am getting unexpected results. I saw this post:

http://answers.unity3d.com/questions/36479/physics-capsulecastall-not-detecting-kinematictrigger-colliders

And I think that I might be having the same issue, but want to make sure I am not doing something dumb.

My raycast line looks like this: RaycastHit[] hits = Physics.SphereCastAll(worldPosition, 1, new Vector3(1,1,1));

I get NORMAL results when I use ONLY SPHERE COLLIDERS set as triggers. Every other kind of collider will not be detected. Strange eh? If I add a capsule/box/mesh with collider in the scene and raycast on the capsule, it never is detected.

Yes, I have checked "Raycast Hit Triggers" in Project->Phyiscs.

Any ideas? Thank you in advance.

more ▼

asked Mar 14 '11 at 08:52 PM

Tyler 10 gravatar image

Tyler 10
88 3 3 7

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

1 answer: sort voted first

If anyone is looking for this, I never could get it to work. I ended up using "OverlapSphere" even though its not as accurate b/c it only tests bounding box areas. For my purposes however, it worked fine.

hits = Physics.OverlapSphere(worldPosition, 2.7F);
for(int k = 0; k < hits.Length; k++)
{
    // do stuff
}
more ▼

answered Apr 19 '11 at 08:20 PM

Tyler 10 gravatar image

Tyler 10
88 3 3 7

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

x1877
x1529
x198
x38

asked: Mar 14 '11 at 08:52 PM

Seen: 1631 times

Last Updated: Mar 14 '11 at 08:52 PM