Hey guys
I am able to rotate my object… but only when my touch is on object…when it moves off object, it stops rotating… Runtime event listeners is working but i want to start rotating the object by getting first touch on the object and not anywhere on the screen
So i wanna able to rotate it even though my touch goes off object while in moved phase…
This is my code
local adjustment = 0 local PI = 3.14159265358 local function onTouch(e) if(e.phase == "began") then local dx = e.x - (ball.x) local dy = e.y - (ball.y) adjustment = math.atan2(dy,dx) \* 180 / PI - ball.rotation elseif(e.phase == "moved") then local dx = e.x - ball.x local dy = e.y - ball.y ball.rotation = (math.atan2(dy,dx) \* 180 / PI) - adjustment end end Runtime:addEventListener('touch', onTouch)