Body.Setgravity -- Constantly flying.

I need to make a body to float once it has been collisioned with another object.

The is on the ground … walking and then, once it collisions with an object, the body starts flighting and needs to be at the same level.

I tried to use Applylinearforce and then setgravity=0 but the body dissapear from the scene.

I need to recreate something like an airplane takking off and flying in a constantly altitude.

Here’s my code. Thanks!

            player:applyLinearImpulse(0, -28, player.x, player.y)

            invencible = true

          

            local TextWin = display.newText( “Super-Invencible!”, 0, 0, “Helvetica”, 50 )

            TextWin:setTextColor(0, 0, 0, 255)

            TextWin.x = display.contentCenterX

            TextWin.y = TextWin.height / 2

                            

            local Volar = function() 

              player.gravityScale = 0

            end

                            

            transition.to(TextWin, {time = 200, alpha = 0, onComplete=Volar})