This article's documentation is for anything that uses the Source engine. Click here for more information.


From Valve Developer Community
(Redirected from Cl showpos)
Jump to: navigation, search
Blank image.pngTodo: The template {{Console command}} is deprecated. Please update to use {{this is a}}. Formatting may appear incorrect

getpos is a console command available in all Source Source games. getpos is a console command available in all Source Source

Obsolete-notext.png Deprecated: The deprecated template {{Game name}} (and similar) was used. Please recreate this icon template with {{Software}} instead.

games. It prints the local player's position and view angle in the console in XYZ tuples.

The output format is "setpos <x> <y> <z>;setang <pitch> <yaw> <roll>". The setpos and ;setang parts are for convenience; These are also console commands used for setting the player position and viewing angle. This lets the user copy the entire output line and paste it back into the console if they want to go to that exact spot again.

A typical output looks like this:

] getpos
setpos 8415.820313 -5248.870117 320.000000;setang -70.642090 71.564941 0.000000

If you don't want the setpos and setang in the output, use spec_pos.

] spec_pos
spec_goto 8415.8 -5248.9 320.0 -70.6 71.6
Note.pngNote:When using setpos you may need to enable noclip to get to a position that would make the player become stuck inside something or when teleporting outside of the map.
Note.pngNote:The commands for setting the player's position or angles require sv_cheats 1. The commands/convars for getting the player's position or angles don't require that, except for Counter-Strike: Global Offensive.

The difference between getpos and getpos_exact (= getpos 2) is the z-height: The former returns the local player's eye position and the latter their origin. These locations are identical for spectators but not for regular players. If you are not spectating and you want to reproduce your current location, you have to use getpos_exact and not getpos. For spectators, both commands return the same result.

The difference between setpos and setpos_exact is just whether or not entities will react to the player's new position. Both commands always set the player's origin, so if you are not spectating, your eye position will have a higher z-height than the z-coordinate that you have entered.

Console Command and Usage Description
getpos Prints the local player's eye position and angles. Invoking the output will put a spectator into the same position.
getpos 2 Prints the local player's origin and angles. Invoking the output will put any player into the same position.
Icon-Bug.pngBug:Counter-Strike: Global Offensive The returned pitch is always 0. Use getpos to actually obtain that value.
getpos_exact (in all games since Left 4 Dead) Equivalent to getpos 2.
spec_pos Equivalent to getpos and getpos 2 respectively but prints the values in the format "spec_goto <x> <y> <z> <pitch> <yaw>" and with just one decimal place for each of the five numbers. The roll value is omitted. Counter-Strike: Global Offensive Does not print the prefix "spec_goto".
spec_pos 2
setpos <x> <y> [z optional] Moves the local player's origin to the specified coordinates. The resulting eye position may be higher.
setang <pitch> <yaw> [roll optional] Snaps the local player's eyes and orientation to the specified angles.
setpos_exact <x> <y> [z optional] Equivalent to setpos or setang respectively, but will automatically enable noclip if moving to a position that would make the player become stuck inside something or when teleporting outside of the map. Entities such as triggers, children and even the player entity itself will acknowledge when this command is used and may react to its use.
setang_exact <pitch> <yaw> [roll optional]
setpos_player <player_index> <x> <y> [z optional]
(in all games since Left 4 Dead)
Moves the specified player to the specified origin, like setpos.
Console Variable Description
cl_showpos If non-zero, draws the local player's current eye position, angles and velocity at the top of the screen.