Why is there no LineCast?

Is there any actual difference in the two shapecasts that I showed? If not, then it’s over-defined given that there is more than one way to do the exact same thing. Also that kind of thing applies to just about any shapecast I could do. the dimension that is in the same direction as the cast can be practically any length as long as it’s not longer than the ray itself. Or at least, that’s what I mean when I say over-defined.

In the diagram I showed, the first shapecast has a longer rectangle (actually it’s a square), and a shorter vector. In the second, the rectangle is shorter, but the vector is longer (also the center of the rectangle is moved up a little so that the back of the square and rectangle are at the same point). They cover the same area and have the same direction, so by my understanding, they accomplish the exact same shapecast while being defined differently.

Also yes, you can share the same Shape2D object between an Area2D and a ShapeCast2D, but they won’t end up covering the same area because the vector changes the area of the ShapeCast2D.

When I say a decision is arbitrary, I’m saying that the two methods literally do the same thing.

The difference is in the sweeped shape. Shapecasts do not live in isolation. They can sweep an actual shape of the object and the same shape can be used for static collision detection in some other collision context the object may participate in. Otherwise you’d need to define a new shape for every different motion step. Remember, shapecasts are meant to represent the motion of a shape. The fact that different motion of different shapes can sometimes result in the same sweeping shape/volume doesn’t make it “over-defined”. Again, you’re looking at it from your very narrow use case that doesn’t involve any motion.

@dragonforge-dev may actually have a point here. Looks like you just need an area. Let’s hear your actual use case. What are you trying to make?

If you want to sweep a line, make a line (a very thin box) and sweep it. Don’t sweep thick boxes if you only want to sweep a line.

A) that is literally the definition of over-defined. If there is more needed than necessary to define something then it is over-defined. B) You actually make a pretty good point regarding how shapecast 2D is often used. Define a shape, let it have collision, and then also be able to cast the same thing down a line to figure out what it would hit.

Thanks for that, it actually clarifies this issue for me quite well. I’m sorry it took me so long to come round to actually understanding the reasoning, but I now understand what you’re getting at. It still bothers me because I come from a very mathematical background, but I now have a better understanding of where this is coming from. And yes, my views are sometimes narrow, but I try to poke and prod at them to increase that view, it just sometimes takes time and patience, which I really appreciate you giving me.

(I still think it would be cool to have a cast for these that isn’t over-defined though lol, but I agree it’s probably less practical)

Last thing, I swear, my understanding of this wasn’t even right for a fair bit of the discussion given that I started saying that you could just define and area and have it sweep that area. Obviously you can’t unless the leading edge of the shape happens to be straight. I still like the idea of a linecast, but in all honesty, it’s pretty niche and doesn’t really provide much benefit vs the shapecast. Could you do what shapecast does more or less with only a leading edge? yes, but it’s more hassle than it’s worth, and you wouldn’t get any detection for the back part of where the shape starts anyway. Also, to add insult to injury, SegmentShape2D is a thing… Now I just feel kind of stupid lol. Mistakes were made, but well, I suppose that’s how one learns.