SetViewPos

From ZDoom Wiki
Jump to navigation Jump to search
Note: This feature is for ZScript only.


Actor

native void SetViewPos (Vector3 offset, int flags = -1)

Usage

Used to set the offset and flags fields within the native readonly ViewPosition ViewPos field in the Actor class. Typically used to offset the viewpoint of the PlayerPawn or camera actor.

Parameters

  • vector3 offset
The vector for the viewpoint's offset.
  • int flags
Any combination of the VPSF flags for the ViewPosition class.
The flags that can be set are:
  • VPSF_ABSOLUTEOFFSET — Don't include angles.
Does not take the actor's angle and pitch into account when applying the offset. When this flag is not set, the offset is computed in the actor's local frame where the actor is always facing the positive x-direction. When the flag is set, the global level axes are used.
  • VPSF_ABSOLUTEPOS — Use absolute position.
Uses the offset as the absolute position in the global level's coordinates, instead of relative to actor's position.
  • VPSF_ALLOWOUTOFBOUNDS — Allow viewpoint to go out of bounds (hardware renderer only).
Allows the viewpoint (but not the actor) to be out of bounds of the level. Backface culling will let you see into the level from behind single-sided walls.
(New from 4.14.2) Rendering of all skies are now stenciled (meaning it won't render behind untextured single-sided walls), and will only render in the current portal group (meaning won't render inside a portal's view) when this is set for the viewpoint camera/actor. Intra-frustum horizontal clipping is disabled when this flag is set. A vertical clipper has been added to compensate, but expect a drop in framerate at shallow view pitches.
  • VPSF_ORTHOGRAPHIC — Use orthographic projection (hardware renderer only).
Switches the viewpoint's projection matrix from perspective to orthographic. All geometry is rendered the same size irrespective of distance from viewpoint. FOV setting (up to 175 degrees) and the length of the Vector3 Offset field will determine the scale of things, with the latter required to be greater than zero. This is useful for isometric mode cameras (See Isometric Mode tutorial). Typically set along with VPSF_ALLOWOUTOFBOUNDS. In addition, depending on the camera/actor's pitch, either all flats (floors/ceilings) whose back is faced to the view are not rendered. The renderer does not traverse the BSP tree but does a simple bounding-box check for all subsectors if either the CVar r_radarclipper is false, or the NoFogOfWar property is set for the map in the MAPINFO lump, resulting in a slightly increased framerate.

Example

Nuvolachalk.png Note: This article lists no examples. If you make use of this feature in your own project(s) or know of any basic examples that could be shared, please add them. This will make it easier to understand for future authors seeking assistance. Your contributions are greatly appreciated.


See also