Apply force to a Body.
A force pushes a body in a direction. A body with with a larger mass will react less. The reaction also depends on how long a force is applied: since the force acts continuously over the entire timestep, a short timestep will only push the body for a short time. Thus forces are best used for many timesteps to give a continuous push to a body (like gravity). For a single push that is independent of timestep, it is better to use Body:applyLinearImpulse.
If the position to apply the force is not given, it will act on the center of mass of the body. The part of the force not directed towards the center of mass will cause the body to spin (and depends on the rotational inertia).
Note that the force components and position must be given in world coordinates.
|Available since LÖVE 0.8.0|
|This variant is not supported in earlier versions.|
Body:applyForce( fx, fy )
- The x component of force to apply to the center of mass.
- The y component of force to apply to the center of mass.
Body:applyForce( fx, fy, x, y )
- The x component of force to apply.
- The y component of force to apply.
- The x position to apply the force.
- The y position to apply the force.
Tiếng Việt –