I’m trying to launch an object at an angle using Corona physics. The idea behind this is to let the player choose an angle for the char object and then the object launches at that angle. However, when I use Angular Impulse, the char object just flips over.
Is there a way to launch the object at an angle and make it go straight?
[code]
local physics = require(“physics”)
physics.start()
physics.setDrawMode( “hybrid” )
local ground = display.newRect(0,610,750,50)
ground:setFillColor(140, 140, 140)
physics.addBody( ground, “static”, { friction=0.5, bounce=0.3 } )
char = display.newRect(0,0,50,150)
char.x = 250;
char.y = ground.y - 85;
physics.addBody( char, “kinetic”, { friction=0.5, bounce=0.3 } )
local function listener( event )
print( “listener called” )
char:applyAngularImpulse( 80 )
end
timer.performWithDelay( 2000, listener )
[/code] [import]uid: 14218 topic_id: 13826 reply_id: 313826[/import]