Little bug with changing location of a shape painter

Hope everyone is having a great start to their weekend!

So I am using a single shape painter object to let the user draw lines from one spot to another at multiple points… And then if certain conditions are met, such as the shape line being drawn is bridging the correct gap, an object spawns. There is also a condition where if the left mouse button is released the shape painter is destroyed.

I’m using the following to create the shape painter at different points…

The issue that I am having is that when you draw a line, the next time you draw one, for a split second it mimics the position the line was in the last time it was present for a split second, and then updates. Everything works properly, this just causes it to look a little sloppy. Any suggestions? I know it is most likely because I am using LastTouchID.X() and LastTouchID.Y() but I’m not sure how else to do it. Thanks in advance!

I don’t quite see the picture, a gif would have helped, but split second issues like this are often a problem of event order.
You’re only showing two events, so I can only suggest swapping those two. :grin:

Sorry I tried to describe it best I could without writing a book. :joy: These apps can get pretty in depth LOL. I will try to provide a gif.

As you can see, when I click and drag to create a new line that follows the cursor, the old line’s position is shown for a split second.

OK, much clearer now :slight_smile:
I don’t know shape painter much, how do you hide or erase your lines?

on left click release → delete String (shape painter)

Should I be using some kind of command to reset the LastTouchID?

You should be using the current touch instead of the last one, no? :thinking:

What is current touch called? because I don’t see a current touch option unless I’m blind LOL. I just tried using this

and it has the same glitch as before.

This also replicates the same issue.

It still works for what I need as far as dragging the line, but still makes the little glitch of the most recent drag for one frame before it corrects.

The solution to this is as follows if anyone is ever looking into this…
Create _isTouched variables for all items that you want to have a draggable line spawn from.
This will be important for when you cross over another point that would spawn another draggable line, it doesn’t if there is already one present by changing the shape painter’s current layer. See the following images for a full function example.

1 Like