func_portal

XashXT

func_portal

An implementation of a portal, similar to those in Portal but less realistic.

Spawnflag

SF_PORTAL_START_OFF 1 (initially turned on and invisible)

Options

target Name for info_portal_destination.
firetarget Target that is activated when the portal is passed through.

Usage Details

  • All portals must have origin brushes. Portals without one will be deleted from the map.
  • Portals use a special texture whose name starts with portal. The texture must be precisely aligned to the brush edges, otherwise rendering artifacts are possible.
  • A portal must always face the player's zeroed-out YAW angle. In other words, the portal texture must be applied in such a way as to face the gaze of the info_player_start whose orientation is 0 0 0. Failing to meet this requirement will cause the image in the portal to distort in uncontrollable ways. To orient the portal in-game as necessary, change its angles.
  • Portal width also affects image distortion. The distortion is minimal at a width of 1 or 2 units.
  • When passing through a portal, the player or any other object keeps the motion direction, acceleration and view angle, but the latter is affected by the angles of the info_portal_destination.
  • You can safely attach a portal using the parent system. However, be careful with ROLL rotations.
  • If anything is obstructing passage through the portal at the spawn point (for example, the exit is blocked by crates), then the passage will not happen until the blocking object is gone. This ensures that teleportation never results in things getting stuck.
  • For double-sided portals (as in the qstyle map, for example), player motion tracking and portal reorientation is implemented so that the portal cannot be entered from behind.
  • Passage through a portal looks fairly seamless if you disregard the sides.
  • A portal can be turned on and off. A turned-off portal is invisible and intangible.