Skip to main content

calc_position

calc_position icon
Point entityPorted from FeaturefulSpirit of Half-Life

A calc_position works out a position from another entity, such as where that entity is, where its eyes are or the middle of its body, adds an offset if you give one, and hands the result to the entity that asks for it.

Triggering it does nothing. Instead, you put its name in a key that takes a position, marked [LP] in the editor, such as the Position of an env_explosion, and each time that key needs a position, the calc_position works it out again at that moment. See the Locus guide for more details and some setups.

Attributes​

KeyDescriptionDefault
Nametargetname

Sets the name you put in another entity's position key so it reads this one. See Common keys.

Entity to usenetname

Names the entity to take the position from. With *locus or !activator, it uses the entity that started the chain of triggers, such as the player who pressed a button.

If you leave this key empty, it works like *locus.

Default *locus
Position to calculateimpulse

Picks which point of that entity the position is.

The 12 choices
  • Origin (0) - The entity's own position. For a brush entity without an origin brush, this is the point 0 0 0 of the map, so pick Center instead
  • Eyes (1) - Where the entity's eyes are, which for a player is where they look from. An entity without eyes gives its Origin
  • Top (2) - The middle of the top of the entity's box
  • Center (3) - The middle of the entity's box
  • Bottom (4) - The middle of the bottom of the entity's box, which for a monster or a player is about where their feet are
  • Attachment point 0 (5) - The first attachment point of the entity's model, a point the model maker placed, such as a hand or the end of a gun barrel
  • Attachment point 1 (6) - The second attachment point
  • Attachment point 2 (7) - The third attachment point
  • Attachment point 3 (8) - The fourth attachment point
  • Random (in its box) (9) - A random point inside the entity's box, which is different every time something asks
  • Calc Position of the entity (10) - Asks the named entity for its own position, so you can chain this to another calc_position or read the position a locus_variable stored
  • Body (11) - The point monsters aim at when they shoot at the entity, which for a monster is between its middle and its eyes, and for a player is a point that changes at random between their chest and their eyes
Default Origin (0)
Add offsetmessage

Adds a vector to the point, such as 0 0 50 to go 50 units up. It takes a locus vector, so it can also name a calc_ entity.

Notes​

  • If the entity named in Entity to use doesn't exist, the calc_position gives no position, so the entity that asked does nothing that time, and with developer 1 set in the console, the console names the calc_position
  • Attachment points only exist on studio models, the .mdl files, that have them, and asking for one that the model doesn't have gives no position
  • Maps made with Spirit of Half-Life 1.8 may call this entity calc_posfroment, and SBO accepts that name too

See also​

Changes since 1.38​

  • calc_position is new in SBO 2.0.0