Adventure Creator  1.73.4
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2019
AC.GameCameraThirdPerson Class Reference
Inheritance diagram for AC.GameCameraThirdPerson:

Public Member Functions

override void _Update ()
void ResetRotation ()
void ForceRotation (bool _controlPitch, float _newPitchAngle, bool _controlSpin, float _newSpinAngle, float _transitionTime=0f, MoveMethod moveMethod=MoveMethod.Linear, AnimationCurve timeCurve=null)
 Rotates the camera automatically to a fixed pitch and/or spin angle. Regular rotation will be disabled while this occurs. 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 ResetTarget ()
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

RotationLock spinLock = RotationLock.Free
RotationLock pitchLock = RotationLock.Locked
bool canRotateDuringConversations = false
bool canRotateDuringCutscenes = false
float horizontalOffset = 0f
float verticalOffset = 2f
float distance = 2f
bool allowMouseWheelZooming = false
bool detectCollisions = true
float collisionRadius = 0.3f
LayerMask collisionLayerMask
float minDistance = 1f
float maxDistance = 3f
bool focalPointIsTarget = false
bool toggleCursor = false
float spinSpeed = 5f
float spinAccleration = 5f
float spinDeceleration = 5f
string spinAxis = ""
bool invertSpin = false
bool alwaysBehind = false
bool resetSpinWhenSwitch = false
float spinOffset = 0f
float maxSpin = 40f
float pitchSpeed = 3f
float pitchAccleration = 20f
float pitchDeceleration = 20f
float maxPitch = 40f
float minPitch = -40f
string pitchAxis = ""
bool invertPitch = false
bool resetPitchWhenSwitch = false
bool inputAffectsSpeed = false
- Public Attributes inherited from AC._Camera
bool targetIsPlayer = true
Transform target
bool isDragControlled = false
float focalDistance = 10f

Protected Member Functions

override void Awake ()
override void Start ()
void DetectCollisions ()
void UpdateSelf ()
void UpdateTargets (bool onStart=false)
bool CanAcceptInput ()
void SnapMovement ()
void SetFocalPoint ()
- Protected Member Functions inherited from AC._Camera
virtual void OnEnable ()
virtual void OnDisable ()
Vector3 PositionRelativeToCamera (Vector3 _position)
Vector3 RightVector ()
Vector3 ForwardVector ()
float ConstrainAxis (float desired, Vector2 range, bool isAngle=false)
void MakeActive ()

Protected Attributes

Vector3 actualCollisionOffset
float deltaDistance = 0f
float deltaSpin = 0f
float deltaPitch = 0f
float roll = 0f
float spin = 0f
float pitch = 0f
float initialPitch = 0f
float initialSpin = 0f
Vector3 centrePosition
Vector3 targetPosition
Quaternion targetRotation
bool autoControlPitch = false
bool autoControlSpin = false
float autoControlTime
float autoControlStartTime
float autoPitchAngle
float autoSpinAngle
MoveMethod autoMoveMethod
AnimationCurve autoMoveCurve
- Protected Attributes inherited from AC._Camera
Char targetChar
Camera _camera
Vector2 inputMovement
bool is2D = false

Additional Inherited Members

- Properties inherited from AC._Camera
Transform Target [get]
Transform CameraTransform [get]
Transform Transform [get]
Camera Camera [get]
bool isFor2D [get, set]
virtual TransparencySortMode TransparencySortMode [get]
Vector3 TargetForward [get]

Detailed Description

A third-person game similar to those found in action-adventure games. The camera will rotate around its target and follow just behind it. It should not be a child of the Player / target - it will attach itself to its target through script.

Member Function Documentation

◆ _Update()

override void AC.GameCameraThirdPerson._Update ( )

Updates the camera. This is called every frame by StateHandler.

Reimplemented from AC._Camera.

◆ ForceRotation()

void AC.GameCameraThirdPerson.ForceRotation ( bool  _controlPitch,
float  _newPitchAngle,
bool  _controlSpin,
float  _newSpinAngle,
float  _transitionTime = 0f,
MoveMethod  moveMethod = MoveMethod.Linear,
AnimationCurve  timeCurve = null 

Rotates the camera automatically to a fixed pitch and/or spin angle. Regular rotation will be disabled while this occurs.

_controlPitchIf True, the pitch angle will be affected
_newPitchAngleThe new pitch angle, if _controlPitch = True
_controlSpinIf True, the spin angle will be affected
_newSpinAngleThe new spin angle, if _controlSpin = True
_transitionTimeThe duration, in seconds, that the rotation will take
moveMethodThe movement method, if _transitionTime > 0 (Linear, Smooth, Curved, EaseIn, EaseOut, CustomCurve)
timeCurveThe AnimationCurve that controls the change in rotation over time, if moveMethod = MoveMethod.CustomCurve

◆ ResetRotation()

void AC.GameCameraThirdPerson.ResetRotation ( )

Resests the spin and pitch rotatsions to their original values.

Member Data Documentation

◆ allowMouseWheelZooming

bool AC.GameCameraThirdPerson.allowMouseWheelZooming = false

If True, the mousewheel can be used to zoom the camera's distance from the target

◆ alwaysBehind

bool AC.GameCameraThirdPerson.alwaysBehind = false

If True, then the camera's spin rotation will be relative to the target's rotation

◆ canRotateDuringConversations

bool AC.GameCameraThirdPerson.canRotateDuringConversations = false

If True, then spin and pitch can be altered when a Conversation is active

◆ canRotateDuringCutscenes

bool AC.GameCameraThirdPerson.canRotateDuringCutscenes = false

If True, then spin and pitch can be altered when gameplay is blocked

◆ collisionLayerMask

LayerMask AC.GameCameraThirdPerson.collisionLayerMask

The LayerMask used to detect collisions, if detectCollisions = True

◆ collisionRadius

float AC.GameCameraThirdPerson.collisionRadius = 0.3f

The size of the SphereCast to use when detecting collisions

◆ detectCollisions

bool AC.GameCameraThirdPerson.detectCollisions = true

If True, then the camera will detect Colliders to try to avoid clipping through walls

◆ distance

float AC.GameCameraThirdPerson.distance = 2f

The normal distance to keep from its target

◆ focalPointIsTarget

bool AC.GameCameraThirdPerson.focalPointIsTarget = false

If True, then focalDistance will match the distance to target

◆ horizontalOffset

float AC.GameCameraThirdPerson.horizontalOffset = 0f

The horizontal position offset

◆ inputAffectsSpeed

bool AC.GameCameraThirdPerson.inputAffectsSpeed = false

If True, then the magnitude of the input vector affects the magnitude of the rotation speed

◆ invertPitch

bool AC.GameCameraThirdPerson.invertPitch = false

If True, then the direction of pitch rotations will be reversed

◆ invertSpin

bool AC.GameCameraThirdPerson.invertSpin = false

If True, then the direction of spin rotations will be reversed

◆ maxDistance

float AC.GameCameraThirdPerson.maxDistance = 3f

The maximum distance to keep from its target

◆ maxPitch

float AC.GameCameraThirdPerson.maxPitch = 40f

The maximum pitch angle, if pitchLock = RotationLock.Limited. This also becomes the locked pitch angle, if pitchLock = RotationLock.Locked

◆ maxSpin

float AC.GameCameraThirdPerson.maxSpin = 40f

The maximum spin angle, if spinLock = RotationLock.Limited

◆ minDistance

float AC.GameCameraThirdPerson.minDistance = 1f

The minimum distance to keep from its target

◆ minPitch

float AC.GameCameraThirdPerson.minPitch = -40f

The minimum pitch angle, if pitchLock = RotationLock.Limited

◆ pitchAccleration

float AC.GameCameraThirdPerson.pitchAccleration = 20f

The acceleration of pitch rotations

◆ pitchAxis

string AC.GameCameraThirdPerson.pitchAxis = ""

The name of the Input axis that controls pitch rotation, if isDragControlled = False

◆ pitchDeceleration

float AC.GameCameraThirdPerson.pitchDeceleration = 20f

The deceleration of pitch rotations

◆ pitchLock

RotationLock AC.GameCameraThirdPerson.pitchLock = RotationLock.Locked

How pitch rotation is affected (Free, Limited, Locked)

◆ pitchSpeed

float AC.GameCameraThirdPerson.pitchSpeed = 3f

The speed of pitch rotations

◆ resetPitchWhenSwitch

bool AC.GameCameraThirdPerson.resetPitchWhenSwitch = false

If True, then the pitch rotation will be reset when the camera is made active

◆ resetSpinWhenSwitch

bool AC.GameCameraThirdPerson.resetSpinWhenSwitch = false

If True, then the spin rotation will be reset when the camera is made active

◆ spinAccleration

float AC.GameCameraThirdPerson.spinAccleration = 5f

The acceleration of spin rotations

◆ spinAxis

string AC.GameCameraThirdPerson.spinAxis = ""

The name of the Input axis that controls spin rotation, if isDragControlled = False

◆ spinDeceleration

float AC.GameCameraThirdPerson.spinDeceleration = 5f

The deceleration of spin rotations

◆ spinLock

RotationLock AC.GameCameraThirdPerson.spinLock = RotationLock.Free

How spin rotation is affected (Free, Limited, Locked)

◆ spinOffset

float AC.GameCameraThirdPerson.spinOffset = 0f

The offset in spin (yaw) angle if alwaysBehind = true

◆ spinSpeed

float AC.GameCameraThirdPerson.spinSpeed = 5f

The speed of spin rotations

◆ toggleCursor

bool AC.GameCameraThirdPerson.toggleCursor = false

If True, then the cursor must be locked for spin rotation to occur (see: IsCursorLocked in PlayerInput)

◆ verticalOffset

float AC.GameCameraThirdPerson.verticalOffset = 2f

The vertical position offset