Click_and_drag tutorial strange behaviour (SOLVED)

Hello everyone!

I have a question about this tutorial.
Can anyone build it to the mobile os (not matter android/ios)?
Do you have the same result as html5 build (or macos)?

I have a strange behaviour, i need to double-tap D-logo before dragging it otherwise it drag previous D-logo. And double-tap does not helps every time.

Hi. I haven’t tried my example on mobile to be honest. It’s probably something wrong in my logic. I’ll take a look straight away.

Why on MacOS on_input called if i move my cursor inside the dmengine window, but on mobile it always spamming the same coordinates (last tapped position) even if i don’t touch screen? Maybe problem is here?

I’ve updated my example to work on touch screens as well. The main issue was that with a mouse the cursor position gets updated all the time as the mouse is moved even if the mouse button isn’t pressed, while on a touch screen the first interaction corresponds to the actual touch. I’ve added some additional comments in cursor.script as well to explain what’s going on.

1 Like

Hello! Thank you @britzl now it is works fine but looks not so clear as before…
Why we need to clean self.collision_id = nil at every frame?

Well, the physics system will update every frame and send a collision_response message when there is a collision between the cursor and a draggable object. But if there is no collision that frame we should make sure to clear collision_id to avoid weird behaviour.