Adventure Creator  1.79.1
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2022
AC._Camera Class Reference
Inheritance diagram for AC._Camera:
AC.CursorInfluenceCamera AC.FirstPersonCamera AC.GameCamera25D AC.GameCamera2DDrag AC.GameCameraThirdPerson AC.GameCamera AC.GameCamera2D AC.GameCameraAnimated

Public Member Functions

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 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...
 
void MakeActive ()
 

Public Attributes

bool targetIsPlayer = true
 
Transform target
 
bool isDragControlled = false
 
float focalDistance = 10f
 

Protected Member Functions

virtual void Awake ()
 
virtual void OnEnable ()
 
virtual void Start ()
 
virtual void OnDisable ()
 
Vector3 PositionRelativeToCamera (Vector3 _position)
 
Vector3 RightVector ()
 
Vector3 ForwardVector ()
 
float ConstrainAxis (float desired, Vector2 range, bool isAngle=false)
 

Protected Attributes

Char targetChar
 
Camera _camera
 
Vector2 inputMovement
 
bool is2D = false
 

Properties

Transform Target [get]
 
Transform CameraTransform [get]
 
Transform Transform [get]
 
Camera Camera [get]
 
bool isFor2D [get, set]
 
virtual TransparencySortMode TransparencySortMode [get]
 
Vector3 TargetForward [get]
 
virtual bool CursorOffsetForcesTranslation [get]
 

Detailed Description

The base class for all Adventure Creator cameras. To integrate a custom camera script to AC, just add this component to the same object as the Camera component, and it will be visible to AC's fields, functions and Actions.

Member Function Documentation

◆ _Update()

virtual void AC._Camera._Update ( )
virtual

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

Reimplemented in AC.GameCamera, AC.GameCamera2DDrag, AC.GameCamera2D, and AC.GameCameraAnimated.

◆ CreateRotationOffset()

virtual Vector2 AC._Camera.CreateRotationOffset ( )
virtual

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.

<return>A vector by which to tweak the camera's rotation.

Reimplemented in AC.GameCamera2D, and AC.CursorInfluenceCamera.

◆ GetPerspectiveOffset()

virtual Vector2 AC._Camera.GetPerspectiveOffset ( )
virtual

Gets the actual horizontal and vertical panning offsets.

Returns
The actual horizontal and vertical panning offsets

Reimplemented in AC.GameCamera2DDrag, AC.GameCamera2D, and AC.GameCamera25D.

◆ Is2D()

virtual bool AC._Camera.Is2D ( )
virtual

Checks if the camera is for 2D games. This is necessary for working out if the MainCamera needs to change its projection matrix.

Returns
True if the camera is for 2D games

Reimplemented in AC.GameCamera2DDrag, and AC.GameCamera2D.

◆ IsActive()

bool AC._Camera.IsActive ( )

Checks if the Camera is currently the MainCamera's active camera (attachedCamera)

Returns
True if the Camera is currently the MainCamera's active camera (attachedCamera)

◆ MakeActive()

void AC._Camera.MakeActive ( )

Makes the Camera the MainCamera's active camera (attachedCamera)

◆ MoveCameraInstant()

virtual void AC._Camera.MoveCameraInstant ( )
virtual

Moves the camera instantly to its destination.

Reimplemented in AC.GameCamera, AC.GameCamera2D, AC.GameCameraAnimated, and AC.GameCamera25D.

◆ RemoveSplitScreen()

void AC._Camera.RemoveSplitScreen ( )

Removes the split-screen effect on this camera.

◆ ResetTarget()

virtual void AC._Camera.ResetTarget ( )
virtual

Auto-assigns "target" as the Player prefab Transform if targetIsPlayer = True.

Reimplemented in AC.FirstPersonCamera, and AC.GameCamera25D.

◆ SetSplitScreen()

void AC._Camera.SetSplitScreen ( )

Enables the camera for split-screen, using the MainCamera as the "main" part of the split, with all the data.

◆ SwitchTarget()

virtual void AC._Camera.SwitchTarget ( Transform  _target)
virtual

Switches the camera's target.

Parameters
_targetThe new target

Reimplemented in AC.GameCamera.

Member Data Documentation

◆ focalDistance

float AC._Camera.focalDistance = 10f

The camera's focal distance

◆ isDragControlled

bool AC._Camera.isDragControlled = false

If True, then the camera can be drag-controlled (used for GameCameraThirdPerson only)

◆ target

Transform AC._Camera.target

The Transform that affects the camera's movement

◆ targetIsPlayer

bool AC._Camera.targetIsPlayer = true

If True, the camera will move according to the Player prefab

Property Documentation

◆ Camera

Camera AC._Camera.Camera
get

The Unity Camera component

◆ CameraTransform

Transform AC._Camera.CameraTransform
get

The Unity Camera's Transform

◆ CursorOffsetForcesTranslation

virtual bool AC._Camera.CursorOffsetForcesTranslation
get

If True, then the influence of the cursor (if any) will cause a change in position, rather than rotation

◆ isFor2D

bool AC._Camera.isFor2D
getset

True if the game plays in 2D, making use of 2D colliders and raycasts

◆ Target

Transform AC._Camera.Target
get

The Transform that affects the camera's movement. If targetIsPlayer = True, this will return the Player's Transform.

◆ Transform

Transform AC._Camera.Transform
get

A cache of the object's transform component

◆ TransparencySortMode

virtual TransparencySortMode AC._Camera.TransparencySortMode
get

The camera's transparency sort mode. This will be copied over to the MainCamera when switched to