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

Page Links


Special Pages


Wikis

?

Render Time: 29ms

DB GetPage 4
Generate Html 2
SaveChanges (1) 9
Render Body 0
Render Sidebar 12