Okay, so I’ve been working on a little side project, and I need a (2D) raycasting based function. So what the function needs to do, is return a Y or X difference from the given point, to the “closest” floor. More specifically, if the point is inside collision, it finds the floor at the top of the collision. Otherwise, it finds the floor below. The issue is, I can’t just raycast up to check for a floor, because what if it’s inside a group of part… Okay, maybe this needs some images.
As you can see, when it’s outside of collision, it works perfectly fine. But when it’s inside, what do I do? I can’t cast down, that returns the bottom, but if I cast up, it returns the middle of the collision. How do I handle this, the intended result is this.
