What do you want to achieve?
Instead of pushing a point through space to find the first point hit, I want to rotate it to find the first point hit. This is not just for boxes, but cylinders, spheres, etc.
The blue circle is the pivot, and the red lines are what I want to rotate on the pivot.
I thought of using editable meshes, to find an edge, but I don’t have the knowledge to make it work, and there is probably better options anyways.
I also thought of having a physics object in the world rotate until it detects something and then working from there, but that takes time.
I also thought of casting many rays each frame to detect an edge, but that gets more costly the thinner the line, and the more the players lagging. This is the most promising solution I could think of, its just a matter of making it look good with thin lines, especially when the object or line is at an angle.
Perhaps you could rotate the origin of the shapecast until it hits something? Or if you want a conical detection, like your illustration shows, you could use this function.
Thank you for your response!
I don’t think it is possible to rotate the shapecast while its in motion, and casting many shapecasts rotating slightly each time runs into accuracy issues.
Thank you for mentioning this, as I forgot to mention it in the original post, but I’m not looking for a cone cast, which is basically pushing a growing circle. I’m looking for a line rotating on a pivot, and detecting the first intersection point. I’ve edited my original post to clarify this.