Draw line between 2 points


I want when the left mouse pressed to draw a line between a ball on the scene and the cursor position and when the mouse is released the line get disappears. what show I do?
When I use draw line action what should I write in shape painter object?


Did you instantiate a Shape Painter instance onto your scene?

for creating a line on the scene, is this the only way?
or there are other ways?

You need the ShapePainter object in your sceene, it’s the object you have to select in your Draw line action.

I’m pretty sure that an instance must be present on the scene, just drag a Shape Painter on the scene and that is what you’ll have to select in the event

I confirm what others say
First you need to have shape painter object in object list
Then either you need to have it on the scene or create it via events
Relax it is invisible

I got mine in lower right corner

Now hold LMB in 1 spot and it will start creating circle

So it is only visible when you want it to be visible set via events

I did what you said:

But when I press the left mouse button on the screen no line is drawn between the ball and the cursor!


I am new to shape painter so i missed one part i should tell you

You see here default settings i did not change anything but i did UN CHECK
Draw the shapes relative to the object position on the scene

And this is only event i use for it

Do not look on my Player.CenterY()-20
That - 20 is there because center point of my player is at his feet so i needed to move it 20 pixels up in expression

And well press LMB

Do you mean I should uncheck it?

Yes, you are right. Now its working.

1 Like