- Home /
Retrieving Multiple RaycastHit Colliders
Hello, I have a raycast that is being sent from one object in the direction of another object and am trying to tell what is intersecting the view between the two objects. Which is simply hit.collider.gameobject... however whenever there are multiple objects between the two then there is a problem and the hit collider info returns null. I'm just trying to find the first object that the raycast hits, the closest to the first object. How can I go about doing this?
Answer by Nachtmahr · Apr 04, 2013 at 09:15 PM
Wait a Second you tell me with your Raycast that looks like that:
s--- wall-wall-target
O------|-----|------O
you get null? If thats the case then
the Walls have no Colliders
your raycast Distance is to short
your Raycast ignores some Layers
your Ray shoots not in the direction you thing
Try to Debug it with Debug.DrawRay(same parameters here);
Eh, yeah I overlooked something, got it resolved no, thanks!
Your answer
Follow this Question
Related Questions
Head shoot and body shoot not working with realistic fps characterDamage 0 Answers
physics.OverlapSphere colliders 1 Answer
Raycast to Detect Collider Issue 1 Answer
multiple colliders 1 Answer