Adventure Creator  1.66.1
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2018
AC.FirstPersonCamera Class Reference
Inheritance diagram for AC.FirstPersonCamera:
AC._Camera

Public Member Functions

void AfterLoad ()
 
new void ResetTarget ()
 
void _UpdateFPCamera ()
 
float GetHeadBobSpeed ()
 Gets the desired head-bobbing speed, to be manipulated via a custom script if headBobMethod = FirstPersonHeadBobMethod.CustomScript. More...
 
void SetPitch (float angle)
 Sets the pitch to a specific angle. More...
 
void IncreasePitch (float increase)
 Increases the pitch, accounting for sensitivity More...
 
- Public Member Functions inherited from AC._Camera
virtual Vector2 CreateRotationOffset ()
 Returns a vector by which to tweak the camera's rotation. The x-axis will control the spin, and the y-axis will control the pitch. More...
 
virtual void SwitchTarget (Transform _target)
 Switches the camera's target. More...
 
virtual bool Is2D ()
 Checks if the camera is for 2D games. This is necessary for working out if the MainCamera needs to change its projection matrix. More...
 
virtual void _Update ()
 
virtual void MoveCameraInstant ()
 
void SetSplitScreen ()
 
void RemoveSplitScreen ()
 
virtual Vector2 GetPerspectiveOffset ()
 Gets the actual horizontal and vertical panning offsets. More...
 
bool IsActive ()
 Checks if the Camera is currently the MainCamera's active camera (attachedCamera) More...
 

Public Attributes

Vector2 sensitivity = new Vector2 (15f, 15f)
 
float minY = -60f
 
float maxY = 60f
 
bool allowMouseWheelZooming = false
 
float minimumZoom = 13f
 
float maximumZoom = 65f
 
bool headBob = true
 
FirstPersonHeadBobMethod headBobMethod = FirstPersonHeadBobMethod.BuiltIn
 
float builtInSpeedFactor = 1f
 
float bobbingAmount = 0.2f
 
string headBobSpeedParameter
 
- Public Attributes inherited from AC._Camera
bool targetIsPlayer = true
 
Transform target
 
bool isDragControlled = false
 
float focalDistance = 10f
 

Protected Member Functions

override void Awake ()
 
- Protected Member Functions inherited from AC._Camera
virtual void Start ()
 
Vector3 PositionRelativeToCamera (Vector3 _position)
 
Vector3 RightVector ()
 
Vector3 ForwardVector ()
 
float ConstrainAxis (float desired, Vector2 range)
 

Additional Inherited Members

- Protected Attributes inherited from AC._Camera
Vector2 inputMovement
 
- Properties inherited from AC._Camera
bool isFor2D [get, set]
 
Vector3 TargetForward [get]
 
Transform Target [get]
 
Camera Camera [get]
 

Detailed Description

A camera used for first-person games. To use it, attach it to a child object of your Player prefab, as well as a Camera. It will then be used during gameplay if SettingsManager's movementMethod = MovementMethod.FirstPerson. This script only affects the pitch rotation - yaw rotation occurs by rotating the base object. Headbobbing code adapted from Mr. Animator's code: http://wiki.unity3d.com/index.php/Headbobber

Member Function Documentation

◆ _UpdateFPCamera()

void AC.FirstPersonCamera._UpdateFPCamera ( )

Updates the camera's transform. This is called every frame by StateHandler.

◆ AfterLoad()

void AC.FirstPersonCamera.AfterLoad ( )

Called after a scene change.

◆ GetHeadBobSpeed()

float AC.FirstPersonCamera.GetHeadBobSpeed ( )

Gets the desired head-bobbing speed, to be manipulated via a custom script if headBobMethod = FirstPersonHeadBobMethod.CustomScript.

Returns
The desired head-bobbing speed. Returns zero if the player is idle.

◆ IncreasePitch()

void AC.FirstPersonCamera.IncreasePitch ( float  increase)

Increases the pitch, accounting for sensitivity

Parameters
increaseThe amount to increase sensitivity by

◆ ResetTarget()

new void AC.FirstPersonCamera.ResetTarget ( )
virtual

Overrides the default in _Camera to do nothing.

Reimplemented from AC._Camera.

◆ SetPitch()

void AC.FirstPersonCamera.SetPitch ( float  angle)

Sets the pitch to a specific angle.

Parameters
angleThe new pitch angle

Member Data Documentation

◆ allowMouseWheelZooming

bool AC.FirstPersonCamera.allowMouseWheelZooming = false

If True, the mousewheel can be used to zoom the camera's FOV

◆ bobbingAmount

float AC.FirstPersonCamera.bobbingAmount = 0.2f

The bobbing magnitude, if headBob = True and headBobMethod = FirstPersonHeadBobMethod.BuiltIn

◆ builtInSpeedFactor

float AC.FirstPersonCamera.builtInSpeedFactor = 1f

The bobbing speed, if headBob = True and headBobMethod = FirstPersonHeadBobMethod.BuiltIn

◆ headBob

bool AC.FirstPersonCamera.headBob = true

If True, then the camera will bob up and down as the Player moves

◆ headBobMethod

FirstPersonHeadBobMethod AC.FirstPersonCamera.headBobMethod = FirstPersonHeadBobMethod.BuiltIn

The method of head-bobbing to employ, if headBob = True (BuiltIn, CustomAnimation, CustomScript)

◆ headBobSpeedParameter

string AC.FirstPersonCamera.headBobSpeedParameter

The name of the float parameter in headBobAnimator to set as the head-bob speed, if headBob = True and headBobMethod = FirstPersonHeadBobMethod.CustomAnimation

◆ maximumZoom

float AC.FirstPersonCamera.maximumZoom = 65f

The maximum FOV, if allowMouseWheelZooming = True

◆ maxY

float AC.FirstPersonCamera.maxY = 60f

The maximum pitch angle

◆ minimumZoom

float AC.FirstPersonCamera.minimumZoom = 13f

The minimum FOV, if allowMouseWheelZooming = True

◆ minY

float AC.FirstPersonCamera.minY = -60f

The minimum pitch angle

◆ sensitivity

Vector2 AC.FirstPersonCamera.sensitivity = new Vector2 (15f, 15f)

The sensitivity of free-aiming