- Home /
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:
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.
Answer by Tyler 10 · Apr 19, 2011 at 08:20 PM
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
}
Your answer
Follow this Question
Related Questions
Physics.CapsuleCast Help 1 Answer
Skateboard slope problem 0 Answers
Physics.Raycast (Cheapest Methods) 0 Answers
Creating a magnetic vehicle (like F-Zero) 1 Answer
Physics.IgnoreRaycastLayer putting GameObject on layer 4 water. 0 Answers