Revision Difference
Entity:GetSequenceGroundSpeed#546886
<function name="GetSequenceGroundSpeed" parent="Entity" type="classfunc">
<description>Returns the ground speed of the entity's sequence.</description>
<realm>Shared</realm>
<args>
<arg name="sequenceId" type="number">The sequence ID.</arg>
<arg name="cycleFrom" type="number" default="0">The point in animation where to start calculating from.</arg>⤶
<arg name="cycleTo" type="number" default="1">The point in animation where to end calculation at.⤶
⤶
`0` to `1` represent the entire sequence animation. Out of bounds values are allowed, such as `0` to `2` will count as if the animation played twice.</arg>⤶
</args>
<rets>
<ret name="" type="number">The ground speed of this sequence.</ret>
</rets>
</function>
<example>
<description>
Move the <page>NextBot</page> based on the ground speed of its walking animation (within its <page>coroutine</page>).
<note>In most cases it's better to use <page>NextBot:BodyMoveXY</page> instead.</note>
</description>
<code>
local sequence = self:LookupSequence( "walk_all" )
if ( sequence ) then
self:StartActivity( ACT_WALK )
self:SetSequence( sequence )
self.loco:SetDesiredSpeed( self:GetSequenceGroundSpeed( sequence ) )
end
</code>
</example>