apply force to an object

I have a problem in my game . is there a way to make a physics body make able to apply force and throw it in any direction?Please help me out … [import]uid: 107104 topic_id: 19230 reply_id: 319230[/import]

Try this:

vx, vy = item:getLinearVelocity()  
  
item:applyLinearImpulse(vx, vy)  

[import]uid: 50459 topic_id: 19230 reply_id: 74208[/import]

There is a helpful example of this already on your computer;

CoronaSDK > SampleCode > Physics > MultiPuck

Peach :slight_smile: [import]uid: 52491 topic_id: 19230 reply_id: 74353[/import]

thanks for the help…But I could not understand how to use as nthing is happening… please help me…
[lua]physics = require( “physics” )
physics.start()
physics.setGravity( 0, 9.8 )

ball = display.newCircle(400,100,100,100)
physics.addBody(ball)

function ballf(event)
if event.phase == “ended” then
vx, vy = ball:getLinearVelocity()
ball:applyLinearImpulse(vx, vy)
end
end

ball:addEventListener(“touch”, ballf)[/lua] [import]uid: 107104 topic_id: 19230 reply_id: 74666[/import]

Play with the multipuck code, read through it, bit by bit - your code is missing some important stuff multipuck is using. [import]uid: 52491 topic_id: 19230 reply_id: 74842[/import]