- Home /
Can i ignore a rigidbody in my Raycast?
Hi
I have a wear problem.
Basically a gameObject call "Parent" and it have some childrens. Both gameobjects have Colliders, well, actually the "Parent" has a Capsule Collider and the child has a Trigger, i already set a layer to the parent different to the one for its child, and when i shoot my ray it does ignore the parent and hit the child as it should work. But later i added a rigidbody to the parent and the ray no longer could ignore the parent.
I already did various testing and definitly is the rigidbody of the parent that the ray wont ignore. So is there a way to ignore a Rigidbody?
Thank!!!!
You can pass a Layer$$anonymous$$ask in Raycast to say what layers you want hit, you can put the parent and children in diferent layers in editor.
I suggest using RayCastAll, then sort the array of hits by distance, and then looping through the arra, ignoring (via "continue") any colliders which have a RB you want.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Rigidbody Sliding UP Incline 0 Answers
How would I get collision at different speeds? 2 Answers
Trying to Understand Rigidbody ForceMode Derivation 3 Answers
Rigidbodies won't collide if mass difference is too high 0 Answers