I am applying linearimpulse to my player while jumping from static platforms. But I am facing a problem that the player gets stuck midair after the impulse, it seems the gravity is not getting applied to it somehow.
My player setup look like this:
physics.start()
physics.setGravity(0, 15)
hero = display.newImageRect( heroGroup, "crate.png", 90, 90)
hero.x = 60
hero.y = 100
physics.addBody( hero, "dynamic", {bounce=0.0, density=0.008})
hero.gravityScale = .8
And on touch of screen, i am applying the impulse
local function touch( event )
if event.phase == "began" then
hero:setLinearVelocity( 0, 0 )
hero:applyLinearImpulse(0, -0.65, hero.x, hero.y )
end
end
Attached is how the player looks like after I touch the screen
Aug-03-2020 12-23-03
Any ideas what am I missing in my setup.