I have a raycast physics system for the player in my game. The raycasts are cast from the center of the player, out in each direction, creating a box of a lot of raycasts. I want these raycasts to be a certain distance from the center, but I want them to ALWAYS go that distance, then check if it is colliding, and return that gameobject. Right now, I think it is stopping the raycast upon hitting the first collider when travelling that distance. For a very specific reason, I need the raycasts to only detect and return the hit at the end of the distance it is travelling. Is this what is happening, and if so is there a way to achieve this effect?
That is indeed what a normal raycast does. You could try RaycastAll, but as it states on the page, there is no guarantee what order the hits are returned in, so you’d still have to figure out which one is at the end.
If you provide a bit more info about what your trying to achieve, perhaps someone can suggest an alternative approach.
What I am trying to achieve is to basically “raycast” at a single point, so there is no line and it would only return a RaycastHit on that one point. I guess that wouldn’t really be a raycast then. For my game, this would mean I can allow a raycast to be false if it is hitting a gameobject with a specific tag in a specific area. I need it to not detect the object if you are inside it while the beginning of the raycast isn’t. It would be a glitch fix for a problem I am having.