Garry's Mod Wiki

Entity:GetSequenceMoveDist

number Entity:GetSequenceMoveDist( number sequenceId )

Description

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

Arguments

1 number sequenceId
The sequence index.

Returns

1 number
The move distance of the sequence.

Example

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

Page Links


Special Pages


Wikis

?

Render Time: 38ms

Session 0
DB GetPage 3
Generate Html 14
SaveChanges 8
Render Body 0
Render Sidebar 12