Classes:ViewPosition

From ZDoom Wiki
Jump to navigation Jump to search

 →All other classes

A class used to define the ViewPos field within the base Actor class. Changing this for the PlayerPawn or Camera actor using SetViewPos can offset the viewpoint. This is typically used for leaning mechanics, micro-positioning viewpoint origin for large actors, and visual effects such as custom view bobbing and recoil (to simulate the shaking chassis of a vehicle or mechsuit, for example) that don't affect the player's aiming or movement controls (since the effect is visual only, and the actor's angle, pitch, and roll are what affect the playsim).

(New from 4.13.0) (hardware renderer only) Additionally, it can be used for setting a camera actor's viewpoint outside of the level's bounds while keeping the camera position within bounds (See Isometric Mode tutorial).

It uses the actors primary angles, with viewangle applied later. It takes into account the actor's pitch and roll by default when offsetting, unless certain flags are set.

Fields

  • vector3 offset
  • int flags

These fields contain the same values as the arguments used by SetViewPos.

ZScript definition

Note: The ZScript definition below is for reference and may be different in the current version of GZDoom.The most up-to-date version of this code can be found on GZDoom GitHub.
class ViewPosition native
{
	native readonly Vector3 Offset;
	native readonly int Flags;
}

See Also