Hi Guys I hope you are well.
I want to make a ray that comes from the player and ends on the object “Ground”, the max distance should be 128px. My attempt can be seen below.
As you can see below, my method doesnt work correctly. The white ray (The object is called “ForceDistance” and the width of this object is changed in the screenshot above) stops before even touching the ground at some positions and on other positions and angles it goes though the gound.
Thank you very much in advance and best regards.
Why are you using an object for that? Why not draw a line with a ShapePainter obejct?
But, to get to your question; I suggest you turn on debugging as an action, to see and understand what the object is doing when you change it’s width. You also need to consider where the ray’s origin is, and how much of a gap/border there is around the image.
I agree with MrMen using the Shape Painter would be better and more accurate.
The issues with this could be your origin or center points of either object or it’s measuring distance from one position or point but then placing it at a different point. Also, if your points aren’t at zero, the gap between the edge of the sprite and the point also grows as the image is stretched. Overall, it’s just not optimal because it also causes the image to be distorted.