Unstable behaviour of drag and drop user input

Hello, sorry to bother again
I have using mr. Britzl extension librarieshttps://defold.com/assets/defoldinput/ for user input drag and drop but it’s have unstable behaviour when i drag and drop

this is my code in cursor controller

function on_message(self, message_id, message, sender)
	local card_scale = go.get_scale(message.id) 
	-- cursor is click and start drag
	if message_id == cursor.CLICKED or message_id == cursor.DRAG_START then
		print("Clicked and drag start", message.id, message.group, message.x, message.y)
		local new_scale = vmath.vector3(card_scale.x + (card_scale.x*.14), card_scale.y+(card_scale.y*.14), card_scale.z)
		go.set_scale(new_scale, message.id)
	end	
end

this is my object code

function on_message(self, message_id, message, sender)
	if message_id == cursor.RELEASED or message_id == cursor.DRAG_END then
		print("release and drag end",message_id, message, sender)
		go.set_scale(self.initial_scale)
	end
end

this is my debug result
DEBUG:SCRIPT: Clicked and drag start hash: [/cards] hash: [card] 250.5 159.16064453125
DEBUG:SCRIPT: release and drag end hash: [drag_end] table: 0x0259b520 url: [main:/cursor#cursor]
DEBUG:SCRIPT: release and drag end hash: [released] table: 0x02dc1020 url: [main:/cursor#cursor]
DEBUG:SCRIPT: Clicked and drag start hash: [/cards] hash: [card] 293.5 625.32800292969
DEBUG:SCRIPT: release and drag end hash: [released] table: 0x02a35830 url: [main:/cursor#cursor]
DEBUG:SCRIPT: Clicked and drag start hash: [/cards] hash: [card] 274.5 586.10357666016
DEBUG:SCRIPT: release and drag end hash: [drag_end] table: 0x02db3210 url: [main:/cursor#cursor]
DEBUG:SCRIPT: release and drag end hash: [released] table: 0x02db3f80 url: [main:/cursor#cursor]
DEBUG:SCRIPT: Clicked and drag start nil nil 207.5 405.06768798828
DEBUG:SCRIPT: Clicked and drag start nil nil 242.5 616.27618408203
DEBUG:SCRIPT: Clicked and drag start nil nil 228.5 329.63610839844
DEBUG:SCRIPT: Clicked and drag start nil nil 205.5 373.38641357422
DEBUG:SCRIPT: Clicked and drag start nil nil 195.5 249.67858886719
DEBUG:SCRIPT: Clicked and drag start nil nil 204.5 415.62811279297
DEBUG:SCRIPT: Clicked and drag start hash: [/cards] hash: [card] 187.5 311.53253173828
DEBUG:SCRIPT: release and drag end hash: [drag_end] table: 0x02da9040 url: [main:/cursor#cursor]
DEBUG:SCRIPT: release and drag end hash: [released] table: 0x02da9790 url: [main:/cursor#cursor]

why the result unstable and how to fix it?
thank you

Please don’t post a lot of debug output without also telling us what we should look for. What is unstable?

the drag and drop don’t responded in 3 times click after I drag and drop game object sir

I am not able to reproduce that problem using any of the examples included with defold-input:

Can you please create a minimal project where this happens and share it here?

Ok sir
Mobile game.zip (1.2 MB)

You did not include the card images and board so I replaced them :slight_smile: I am however unable to reproduce any problems with the drag’n’drop:

Which OS are you using?

1 Like

I am using old windows 7 sir

Yeah, I have no idea why it doesn’t work. Perhaps you could try your own minimal project? Make sure to please also enable physics debugging to verify that the collision shapes are where you expect them to be!

1 Like

Ok ,thank you for advice i will check it later because i still in working hour now

hello , sorry for late posting because I also get flu at 3 days. I already found the culprit. The game object cursor seems not following cursor machine

anyway looks like this problem is show just in mobile build version

You need to translate the screen coordinates to world coordinates before updating the cursor position: