Garry's Mod Wiki

PhysObj:GetEnergy

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

Special Pages


Wikis

?

Render Time: 58ms

DB GetPage 38
Generate Html 2
SaveChanges (1) 6
Render Body 0
Render Sidebar 10