Rotate object with mouse cursor

Hello guys, I’m new to this and I wanted to make the object rotate following the mouse cursor, but the object rotated only to one side, I wanted the object to rotate quickly in any direction, following the mouse. Can someone help me?


local triangle = display.newPolygon( display.contentCenterX, display.contentCenterY, { 0, 0, -5, 35, 5, 35 } )

local function Mouse( event )

    --tempX = dot.x  + Cos(Rad(angle)) * radius

    --tempY = dot.y  + Sin(Rad(angle)) * radius

        triangle.rotation = triangle.rotation+2;


        --angle = angle+1


local function moveForward()

    event.x = triangle.x + Cos(math.rad(triangle.rotation))*1

    event.y = triangle.y + Sin(math.rad(triangle.rotation))*1





Runtime:addEventListener( ‘mouse’, Mouse)

Hi @victao.mauricio
It’s been while but do you still need help with this? If so, paste some formatted code and I’ll take a look