Type Function Object Body Library physics.* Return value none Revision Release 2022.3683 Keywords body, applyLinearImpulse See also object:applyForce() object:setLinearVelocity() object.linearDamping object:applyAngularImpulse()
Similar to object:applyForce() except that an impulse is a single momentary jolt.
object:applyLinearImpulse( xForce, yForce, bodyX, bodyY )
Numbers. Amount of force to apply in the x and y directions respectively.
Numbers. Point on the object to apply the force to.
-- Create a rectangle local myRect = display.newRect( 0, 0, 100, 100 ) -- Add a body to the rectangle physics.addBody( myRect, "dynamic" ) -- Apply linear impulse myRect:applyLinearImpulse( 60, 20, myRect.x, myRect.y )