Hello everyone, colleagues! I want to make when the archer starts aiming, a red line appears that indicates where the arrow will fly.
Here are the questions:
- How do I make a red and transparent line that will be drawn in a straight line?
- If the line is drawn, then it should end at the point of contact with the wall.
How do I do this? I hope for your help, colleagues.
(In this example, the line should go to the left. And touching the wall to end.)
You can use the ‘shape painter’-object for that.
You can use a raycast for checking the position of the wall and you can also use the raycast’s variables for determining the end of the line of the shape painter.
There is a good example that demonstrates how it works:
Thank you very much for the answer! I tried to do it.
But there was a problem. Shape Painter does not draw a line. The values of the ContactX and Y variables change. What could be the problem?
IDK how familiar you are with the shape painter. Just some things that we’ve all done.
Is there a shape painter on the scene? It happens. Does it have a higher z-order value? It might be covered by another object like the background. In the settings, is the “draw the shapes relative to the object” checked? If checked, the objects x,y act as the origin and the x,y are added to it’s position. I usually uncheck it. Is the “clear the rendered image between each frame” checked? If check then make sure the draw action is able to be triggered continuously while you want the line to be seen. Otherwise, it’ll draw it and disappear. You can uncheck it and then clear the image manually with its “clear shapes” action.
Thank you very much, colleague)))
It looks really good. What was the solution?
I did everything you advised. I delete the drawing using the code. This is the first time I’ve used shape painter)