PhysObj:ApplyForceCenter
Description
Applies the specified impulse in the mass center of the physics object.
This will not work on players, use Entity:SetVelocity instead.
Arguments
Example
An entity that simulates its own gravity by applying a force downward on the entity based on the force equation:
(Force = mass * acceleration)
Since, by default, entities already have gravity, the default gravity must be turned off by adding phys:EnableGravity(false)
in the entity's Initialize function so that the default gravity doesn't interfere with our custom gravity.
NOTE: We can get the mass of the entity by using the PhysObj:GetMass function.
-9.80665 (meters / second ^ 2) Is the approximate acceleration of objects on Earth due to gravity. (It is negative because gravity pushes things downwards.)
Considering that the unit of the impulse that ApplyForceCenter accepts is kg*source_unit / s, we have to do unit conversion: 1 meter ≈ 39.37 source units (on entity scale)