CLuaLocomotion
This class is essentially what controls a NextBot NPC. You can access it in a NextBot NPC by using self.loco variable.
Methods
Moves the NextBot incrementally closer to the provided goal location.
Each time this function is called, the NextBot moves towards the goal position passed as an argument by the amount previously set by CLuaLocomotion:SetDesiredSpeed.
To achieve smooth movement, this function must be called frequently.
This is commonly accomplished by calling it in the ENTITY:Think hook.
CLuaLocomotion:ClearStuck()
Removes the stuck status from the bot
CLuaLocomotion:FaceTowards( Vector goal )
Sets the direction we want to face
number CLuaLocomotion:GetAcceleration()
Returns the acceleration speed
boolean CLuaLocomotion:GetAvoidAllowed()
Returns whether the Nextbot is allowed to avoid obstacles or not.
boolean CLuaLocomotion:GetClimbAllowed()
Returns whether the Nextbot is allowed to climb or not.
Vector CLuaLocomotion:GetCurrentAcceleration()
Returns the current acceleration as a vector
number CLuaLocomotion:GetDeathDropHeight()
Gets the height the bot is scared to fall from
number CLuaLocomotion:GetDeceleration()
Gets the deceleration speed
number CLuaLocomotion:GetDesiredSpeed()
Returns the desired movement speed set by CLuaLocomotion:SetDesiredSpeed
number CLuaLocomotion:GetGravity()
Returns the locomotion's gravity.
Vector CLuaLocomotion:GetGroundMotionVector()
Return unit vector in XY plane describing our direction of motion - even if we are currently not moving
Vector CLuaLocomotion:GetGroundNormal()
Returns the current ground normal.
boolean CLuaLocomotion:GetJumpGapsAllowed()
Returns whether the Nextbot is allowed to jump gaps or not.
number CLuaLocomotion:GetJumpHeight()
Gets the height of the bot's jump
number CLuaLocomotion:GetMaxJumpHeight()
Returns maximum jump height of this CLuaLocomotion.
number CLuaLocomotion:GetMaxYawRate()
Returns the max rate at which the NextBot can visually rotate.
NextBot CLuaLocomotion:GetNextBot()
Returns the NextBot this locomotion is associated with.
number CLuaLocomotion:GetStepHeight()
Gets the max height the bot can step up
Vector CLuaLocomotion:GetVelocity()
Returns the current movement velocity as a vector
Returns whether this CLuaLocomotion can reach and/or traverse/move in given CNavArea.
boolean CLuaLocomotion:IsAttemptingToMove()
Returns true if we're trying to move.
boolean CLuaLocomotion:IsClimbingOrJumping()
Returns true of the locomotion engine is jumping or climbing
boolean CLuaLocomotion:IsOnGround()
Returns whether the nextbot this locomotion is attached to is on ground or not.
boolean CLuaLocomotion:IsUsingLadder()
Returns whether or not the target in question is on a ladder or not.
Makes the bot jump. It must be on ground (Entity:IsOnGround) and its model must have ACT_JUMP activity.
Makes the bot jump across a gap. The bot must be on ground (Entity:IsOnGround) and its model must have ACT_JUMP activity.
CLuaLocomotion:SetAcceleration( number speed = 400 )
Sets the acceleration speed
CLuaLocomotion:SetAvoidAllowed( boolean allowed )
Sets whether the Nextbot is allowed try to to avoid obstacles or not. This is used during path generation. Works similarly to nb_allow_avoiding convar. By default bots are allowed to try to avoid obstacles.
CLuaLocomotion:SetClimbAllowed( boolean allowed )
Sets whether the Nextbot is allowed to climb or not. This is used during path generation. Works similarly to nb_allow_climbing convar. By default bots are allowed to climb.
CLuaLocomotion:SetDeathDropHeight( number height = 200 )
Sets the height the bot is scared to fall from.
CLuaLocomotion:SetDeceleration( number deceleration = 400 )
Sets the deceleration speed.
CLuaLocomotion:SetDesiredSpeed( number speed = 0 )
Sets how far the NextBot will need to move each time CLuaLocomotion:Approach is called to move at given speed.
The default amount is 0. This means the bot will not move if this value has not been set.
CLuaLocomotion:SetGravity( number gravity = 1000 )
Sets the locomotion's gravity.
With values 0 or below, or even lower positive values, the nextbot will start to drift sideways, use CLuaLocomotion:SetVelocity to counteract this.
CLuaLocomotion:SetJumpGapsAllowed( boolean allowed )
Sets whether the Nextbot is allowed to jump gaps or not. This is used during path generation. Works similarly to nb_allow_gap_jumping convar. By default bots are allowed to jump gaps.
CLuaLocomotion:SetJumpHeight( number height = 58 )
Sets the height of the bot's jump
CLuaLocomotion:SetMaxYawRate( number yawRate = 250 )
Sets the max rate at which the NextBot can visually rotate. This will not affect moving or pathing.
CLuaLocomotion:SetStepHeight( number height = 18 )
Sets the max height the bot can step up
CLuaLocomotion:SetVelocity( Vector velocity )
Sets the current movement velocity