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?
1 Answer
1Wait 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!
– Chimera3D