PlayerCamera

Use these methods to access the player cameras.

Static members

Member

Description

activeCamera

Get the player’s currently active camera.

fpCamera

Get the player’s first person camera.

fpCameraLocalPosition

The first person camera’s local offset position.

fpCameraLocalRotation

The first person camera’s local offset rotation.

isUsingOverrideCamera

True when an override camera is active.

tpCamera

Get the player’s third person camera.

Static methods

Method

Description

ApplyRecoil(recoil, applyCameraKick)

Apply a recoil on the first person weapon. Optionally also kicks the camera.

ApplyScreenshake(magnitude, iterations)

Apply a screen shake effect.

ApplyWeaponSnap(magnitude, frequency, duration)

Makes the first person weapon wobble up and down.

CancelOverrideCamera()

Cancel the camera override.

FirstPersonCamera()

Switch to first person camera.

KickCamera(kickEuler)

Kick the first person camera by an euler rotation.

OverrideActiveCamera(camera)

Override the active camera.

ResetRecoil()

Instantly resets any first person weapon recoil.

RotateFirstPersonCamera(rotation)

Rotates the player camera, simulating player mouse movement.

ThirdPersonCamera()

Switch to third person camera.

Details

class PlayerCamera
static const Camera activeCamera

Get the player’s currently active camera.

static const Camera fpCamera

Get the player’s first person camera. This is the camera that is active while the player is running around as infantry or in a vehicle without a special camera.

static Vector3 fpCameraLocalPosition

The first person camera’s local offset position. This is an offset from the default value, and is always Vector3.zero by default.

static Quaternion fpCameraLocalRotation

The first person camera’s local offset rotation. This is an offset from the default value, and is always Quaternion.identity by default.

static const bool isUsingOverrideCamera

True when an override camera is active. An override camera is typically used when the player enters a vehicle with a custom camera setup.

static const Camera tpCamera

Get the player’s third person camera. This is the camera that is active while the player is ragdolled. This is not the same as the third person camera while inside vehicles.

static void ApplyRecoil(Vector3 recoil, bool applyCameraKick)

Apply a recoil on the first person weapon. Optionally also kicks the camera.

static void ApplyScreenshake(float magnitude, int iterations)

Apply a screen shake effect.

static void ApplyWeaponSnap(float magnitude, float frequency, float duration)

Makes the first person weapon wobble up and down.

static void CancelOverrideCamera()

Cancel the camera override. Returns to the player’s default first person or third person camera.

static void FirstPersonCamera()

Switch to first person camera.

static void KickCamera(Vector3 kickEuler)

Kick the first person camera by an euler rotation.

static void OverrideActiveCamera(Camera camera)

Override the active camera.

static void ResetRecoil()

Instantly resets any first person weapon recoil.

static void RotateFirstPersonCamera(Vector2 rotation)

Rotates the player camera, simulating player mouse movement.

static void ThirdPersonCamera()

Switch to third person camera.