Garry's Mod Wiki

PhysObj:GetEnergy

  number PhysObj:GetEnergy()

Description

Returns the sum of the linear and rotational kinetic energies of the physics object.

Returns

1 number
The kinetic energy

Example

Replicates what GetEnergy does internally.

local linear_kenergy = 0.5 * phys:GetMass() * phys:GetVelocity() ^ 2 -- 1/2 mv^2 local rotational_kenergy = 0.5 * phys:GetInertia() * phys:GetAngleVelocity() ^ 2 -- 1/2 Iw^2 local kenergy = linear_kenergy + rotational_kenergy