Garry's Mod Wiki

Animation Layer​s (BaseAnimatingOverlay)

Entities based on BaseAnimatingOverlay are capable of layering animations.

NextBots and Players are BaseAnimatingOverlay entities.

Only Scripted Entities of the anim type are BaseAnimatingOverlay.

Playing gestures/creating new layers on NextBots may not work correctly unless done in the NEXTBOT:BehaveUpdate hook.

The following functions can only be used on BaseAnimatingOverlay entities:

Example

Example usage of layers on a anim type SENT.

AddCSLuaFile() DEFINE_BASECLASS( "base_gmodentity" ) ENT.PrintName = "Example Animated Overlay" ENT.AutomaticFrameAdvance = true function ENT:Initialize() if ( SERVER ) then -- Basic set up - a model with animations and physics mode so it doesn't fall over for demonstration self:SetModel( "models/alyx.mdl" ) self:PhysicsInit( SOLID_OBB ) self:ResetSequence( "walk_all" ) -- Base sequence, walking self:SetPoseParameter( "move_yaw", 90 ) -- Affects how the base sequence looks -- Overlayed sequence on top of base animation, move the head -- false at the end to not kill the animation after it plays once. self.LayerID = self:AddGestureSequence( self:LookupSequence( "a_bg_lookupright" ), false ) self:SetLayerLooping( self.LayerID, true ) -- Loop the layer end end function ENT:Think() if ( SERVER ) then -- Do any logic with layers here, play them, stop them, etc. -- Make sure the animation is smooth self:NextThink( CurTime() ) return true end end