- Home /
Raycast detects only on one side problem?
Ok, so i have a strange problem here cos I want to make my ship to detect hit strenght in 8 locations, its collider is a box and those 8 points are detected using 4 rays. And here comes the problem:
When Ray detects a collision that begins at the end of the raycast then everything is fine, hit.distance is larger than half of rays lenght and it is cool, but when collision begins at the beggining of the ray (hit.distance should be smaller than half of ray's lenght) it just doesn't detect that, print doesn't print anything so I assume it just doesn't work.
Now I want to know if this is a Unity related bug or it is just me?
Okay, to be clear; You are raycasting from one point, outside of the box to a point that is inside of the box. Correct?
Assu$$anonymous$$g that, when the distance to the hit point is less than half of the ray's length you do not receive a hit location at all?
Are you always projecting the ray in one direction or something?
Nope, I'm raycasting from outside of the box on left side to outside of the box on right side with layer$$anonymous$$ask to not detect this collider but detect others. Ray is pointed in one direction always (from left side to right where left side is not detected, no hit location)
Your answer
Follow this Question
Related Questions
How do I make an Android touch main menu? 3 Answers
Raycast doesn't update 1 Answer
Raycast lines debug problem 1 Answer
Unity c# Raycast axis stuck on one axis 0 Answers
How to make sure that the raycast points in the right direction? 1 Answer