Garry's Mod Wiki

physenv.GetLastSimulationTime

  number physenv.GetLastSimulationTime()

Description

Returns the last simulation duration of the in-game physics.

Returns

1 number
The last simulation duration of the in-game physics in seconds

Example

Prints a message when physics lag of over 100ms is detected

hook.Add("Think", "LagDetector", function () if physenv.GetLastSimulationTime() * 1000 > 100 then print("Physics lag detected!") end end)