PlayerCamera
Use these methods to access the player cameras.
Static members
Member |
Description |
---|---|
|
Get the player’s currently active camera. |
|
Get the player’s first person camera. |
|
The first person camera’s local offset position. |
|
The first person camera’s local offset rotation. |
|
True when an override camera is active. |
|
Get the player’s third person camera. |
Static methods
Method |
Description |
---|---|
Apply a recoil on the first person weapon. Optionally also kicks the camera. |
|
Apply a screen shake effect. |
|
Makes the first person weapon wobble up and down. |
|
Cancel the camera override. |
|
Switch to first person camera. |
|
Kick the first person camera by an euler rotation. |
|
Override the active camera. |
|
Instantly resets any first person weapon recoil. |
|
Rotates the player camera, simulating player mouse movement. |
|
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 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.
-
static const Camera activeCamera