Garry's Mod Wiki

Revision Difference

Entity:GetVelocity#547116

<function name="GetVelocity" parent="Entity" type="classfunc"> <description> Returns the entity's velocity. <note>Actually binds to CBaseEntity::GetAbsVelocity() on the server and C_BaseEntity::EstimateAbsVelocity() on the client. This returns the total velocity of the entity and is equal to local velocity + base velocity.</note> <bug issue="774">This can become out-of-sync on the client if the server has been up for a long time.</bug> </description> <realm>Shared</realm> <rets> <ret name="" type="Vector">The velocity of the entity.</ret> </rets> </function> ⤶ <example>⤶ <description>Lets you know if the object is being moved.</description>⤶ <code>⤶ ⤶ //always do a isvalid check!!⤶ if ent:IsValid() then⤶ if ent:GetVelocity():Length() > 0 then⤶ //is being rotated⤶ else⤶ //not being rotated⤶ end⤶ end )⤶ </code>⤶ </example>⤶