Garry's Mod Wiki

Garry's Mod Wiki

  number Entity:GetSequenceMoveDist( number sequenceId )


Returns an entity's sequence move distance (the change in position over the course of the entire sequence).

See Entity:GetSequenceMovement for a similar function with more options.


1 number sequenceId
The sequence index.


1 number
The move distance of the sequence.


Experiment which demonstrates that dividing the sequence move distance by Entity:SequenceDuration results in a value extremely close to Entity:GetSequenceGroundSpeed.

local ply, seq, move_dist, seq_dur, ground_speed = nil, nil, nil, nil, nil function GM:Think() -- Player 1 ply = Entity(1) -- Current sequence seq = ply:GetSequence() -- The move distance move_dist = ply:GetSequenceMoveDist(seq) if(move_dist == 0) then return end -- If it doesn't move, don't bother -- The sequence duration seq_dur = ply:SequenceDuration(seq) -- Actual sequence ground speed ground_speed = ply:GetSequenceGroundSpeed(seq) -- Compare the calculated value to the actual value print(tostring(ground_speed-(move_dist/seq_dur))) end
Output: A sample of some of the calculated vs. actual value differences during a sprint forward followed by an abrupt stop.
-3.3345255872064e-006 3.3614563506035e-006 0 1.557984873557e-006

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated twice a day. Edits and history are not available.

Last Parsed: Loading...