Collision On Transition.to

After doing some research, I’m still having some issues getting my collisions correct when I move using transition.to. The transition cancels correctly, but it then sticks to the object it collided with and I have to click a second time to move. It also has the problem of being able to pass through the object once it is already in the collision stage. Is there some way to fix these two issues?

        local function tapMovement( event )

            --Get the distance between 2 objects

            local delta = math.ceil(math.sqrt( ((event.y - player.y) * (event.y - player.y)) + ((event.x - player.x) * (event.x-player.x)) ))

            local moveTime = delta * 7

            player.isActive = true

            playerTween = transition.to( player, { time=moveTime, x=event.x, y=event.y } )

            

            local function onCollision( event )

                transition.cancel( playerTween )

            end

            

            player.collision = onCollision

            player:addEventListener( “collision”, player )

        end

            

        Runtime:addEventListener( “tap”, tapMovement )