Garry's Mod Wiki

MOVETYPE

Description

Enumerations used by Entity:SetMoveType and Entity:GetMoveType.

Values

MOVETYPE_NONE0Don't move
MOVETYPE_ISOMETRIC1For players, in TF2 commander view, etc
MOVETYPE_WALK2Player only, moving on the ground
MOVETYPE_STEP3Monster/NPC movement
MOVETYPE_FLY4Fly, no gravity
MOVETYPE_FLYGRAVITY5Fly, with gravity
MOVETYPE_VPHYSICS6Physics movetype
MOVETYPE_PUSH7Doesn't collide with the world, but does push and crush entities.
This is what is used by the engine for elevators, trains, doors, moving water, etc.

In order to work properly, the entity needs to have specific Save Values/Internal Variables set which tell it how long it should be moving for.

Note: This same process can be done for both position and angle.

1. You'll need to Get an existing Save Value called ltime
2. Calculate how long (in seconds) the entity will be moving before it reaches its destination.
As a simple example, this can be done via duration = distance / speed
3. Set the Save Value for m_flMoveDoneTime to the value you retrieved for ltime plus the duration calculated in step 2.
Put more simply: m_flMoveDoneTime = ltime + duration
4. Set the entity's velocity to move it to the destination at the speed used in step 2.

Once the duration of the move has elapsed, the entity will stop moving. If you have done your calculations correctly, it should stop exactly at the desired destination.

MOVETYPE_PUSH entities only move during Entity:Think so if you want smooth movement, you need to set Entity:NextThink to CurTime, which instructs the entity to execute Entity:Think as quickly as possible.
MOVETYPE_NOCLIP8Noclip
MOVETYPE_LADDER9For players, when moving on a ladder
MOVETYPE_OBSERVER10Spectator movetype. DO NOT use this to make player spectate
MOVETYPE_CUSTOM11Custom movetype, can be applied to the player to prevent the default movement code from running, while still calling the related hooks