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

Public Member Functions

override void _Update ()
 
void ForceRecordOriginalPosition ()
 
override 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...
 
override void MoveCameraInstant ()
 
void SnapToOffset ()
 
void SetCorrectRotation ()
 
bool IsCorrectRotation ()
 Checks if the GameObject's rotation matches the intended rotation, according to the chosen settings in SettingsManager. More...
 
override Vector2 GetPerspectiveOffset ()
 Gets the actual horizontal and vertical panning offsets. More...
 
void SetPerspectiveOffset (Vector2 _perspectiveOffset)
 Sets the actual horizontal and vertical panning offsets. Be aware that the camera will still be subject to the movement set by the target, so it will move back to its original position afterwards unless you also change the target. More...
 
override 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...
 
- Public Member Functions inherited from AC.CursorInfluenceCamera
void ShowCursorInfluenceGUI ()
 
- Public Member Functions inherited from AC._Camera
virtual void SwitchTarget (Transform _target)
 Switches the camera's target. More...
 
virtual void ResetTarget ()
 
void SetSplitScreen ()
 
void RemoveSplitScreen ()
 
bool IsActive ()
 Checks if the Camera is currently the MainCamera's active camera (attachedCamera) More...
 
void MakeActive ()
 

Public Attributes

bool lockHorizontal = true
 
bool lockVertical = true
 
bool limitHorizontal
 
bool limitVertical
 
SpriteRenderer backgroundConstraint = null
 
bool autoScaleToFitBackgroundConstraint = false
 
Vector2 constrainHorizontal
 
Vector2 constrainVertical
 
Vector2 freedom = Vector2.zero
 
float dampSpeed = 0.9f
 
Vector2 directionInfluence = Vector2.zero
 
Vector2 afterOffset = Vector2.zero
 
bool doSnapping = false
 
float unitSnap = 0.1f
 
- Public Attributes inherited from AC.CursorInfluenceCamera
bool followCursor = false
 
Vector2 cursorInfluence = new Vector2 (0.3f, 0.1f)
 
bool constrainCursorInfluenceX = false
 
Vector2 limitCursorInfluenceX
 
bool constrainCursorInfluenceY = false
 
Vector2 limitCursorInfluenceY
 
float followCursorSpeed = 3f
 
CutsceneBehaviour cutsceneBehaviour = CutsceneBehaviour.Freeze
 
- 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 OnEnable ()
 
override void OnDisable ()
 
override void Start ()
 
void OnInitialiseScene ()
 
void OnTeleport (GameObject _gameObject)
 
void OnUpdatePlayableScreenArea ()
 
void UpdateBackgroundConstraint ()
 
void SetDesired ()
 
void MoveCamera ()
 
void SetOriginalPosition ()
 
void SetProjection ()
 
Vector2 GetOffsetForPosition (Vector3 targetPosition)
 
Vector2 GetSnapOffset ()
 
- Protected Member Functions inherited from AC._Camera
Vector3 PositionRelativeToCamera (Vector3 _position)
 
Vector3 RightVector ()
 
Vector3 ForwardVector ()
 
float ConstrainAxis (float desired, Vector2 range, bool isAngle=false)
 

Protected Attributes

Vector2 perspectiveOffset = Vector2.zero
 
Vector3 originalPosition = Vector3.zero
 
Vector2 desiredOffset = Vector2.zero
 
bool haveSetOriginalPosition = false
 
LerpUtils.FloatLerp xLerp = new LerpUtils.FloatLerp ()
 
LerpUtils.FloatLerp yLerp = new LerpUtils.FloatLerp ()
 
- Protected Attributes inherited from AC.CursorInfluenceCamera
Vector2 actualCursorOffset
 
- Protected Attributes inherited from AC._Camera
Char targetChar
 
Camera _camera
 
Vector2 inputMovement
 
bool is2D = false
 

Properties

override TransparencySortMode TransparencySortMode [get]
 
- 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]
 
virtual bool CursorOffsetForcesTranslation [get]
 

Additional Inherited Members

- Public Types inherited from AC.CursorInfluenceCamera
enum  CutsceneBehaviour { Freeze, Allow, Reset }
 

Detailed Description

The standard 2D camera. It can be scrolled horizontally and vertically without altering perspective (causing a "Ken Burns effect" if the camera uses Perspective projection. Based on the work by Eric Haines (Eric5h5) at http://wiki.unity3d.com/index.php?title=OffsetVanishingPoint

Member Function Documentation

◆ _Update()

override void AC.GameCamera2D._Update ( )
virtual

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

Reimplemented from AC._Camera.

◆ CreateRotationOffset()

override Vector2 AC.GameCamera2D.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 from AC.CursorInfluenceCamera.

◆ ForceRecordOriginalPosition()

void AC.GameCamera2D.ForceRecordOriginalPosition ( )

Force-sets the current position as its original position. This should not normally need to be called externally.

◆ GetPerspectiveOffset()

override Vector2 AC.GameCamera2D.GetPerspectiveOffset ( )
virtual

Gets the actual horizontal and vertical panning offsets.

Returns
The actual horizontal and vertical panning offsets

Reimplemented from AC._Camera.

◆ Is2D()

override bool AC.GameCamera2D.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 from AC._Camera.

◆ IsCorrectRotation()

bool AC.GameCamera2D.IsCorrectRotation ( )

Checks if the GameObject's rotation matches the intended rotation, according to the chosen settings in SettingsManager.

Returns
True if the GameObject's rotation matches the intended rotation<returns>

◆ MoveCameraInstant()

override void AC.GameCamera2D.MoveCameraInstant ( )
virtual

Moves the camera instantly to its destination.

Reimplemented from AC._Camera.

◆ SetCorrectRotation()

void AC.GameCamera2D.SetCorrectRotation ( )

Sets the camera's rotation and projection according to the chosen settings in SettingsManager.

◆ SetPerspectiveOffset()

void AC.GameCamera2D.SetPerspectiveOffset ( Vector2  _perspectiveOffset)

Sets the actual horizontal and vertical panning offsets. Be aware that the camera will still be subject to the movement set by the target, so it will move back to its original position afterwards unless you also change the target.

Parameters
_perspectiveOffsetThe new offsets

◆ SnapToOffset()

void AC.GameCamera2D.SnapToOffset ( )

Snaps the camera to its offset values and recalculates the camera's projection matrix.

Member Data Documentation

◆ afterOffset

Vector2 AC.GameCamera2D.afterOffset = Vector2.zero

The intended horizontal and vertical panning offsets

◆ autoScaleToFitBackgroundConstraint

bool AC.GameCamera2D.autoScaleToFitBackgroundConstraint = false

If True, and backgroundConstraint is set, then the camera will zoom in to fit the background if it is too zoomed out to fit

◆ backgroundConstraint

SpriteRenderer AC.GameCamera2D.backgroundConstraint = null

If set, then the sprite's bounds will be used to set the horizontal and vertical limits, overriding constrainHorizontal and constrainVertical

◆ constrainHorizontal

Vector2 AC.GameCamera2D.constrainHorizontal

The lower and upper horizontal limits, if limitHorizontal = True

◆ constrainVertical

Vector2 AC.GameCamera2D.constrainVertical

The lower and upper vertical limits, if limitVertical = True

◆ dampSpeed

float AC.GameCamera2D.dampSpeed = 0.9f

The follow speed when tracking a target

◆ directionInfluence

Vector2 AC.GameCamera2D.directionInfluence = Vector2.zero

The influence that the target's facing direction has on the tracking position

◆ doSnapping

bool AC.GameCamera2D.doSnapping = false

If True, the camera will only move in steps, as if snapping to a grid

◆ freedom

Vector2 AC.GameCamera2D.freedom = Vector2.zero

The amount of freedom when tracking a target. Higher values will result in looser tracking

◆ limitHorizontal

bool AC.GameCamera2D.limitHorizontal

If True, then horizontal panning will be limited to minimum and maximum values

◆ limitVertical

bool AC.GameCamera2D.limitVertical

If True, then vertical panning will be limited to minimum and maximum values

◆ lockHorizontal

bool AC.GameCamera2D.lockHorizontal = true

If True, then horizontal panning is prevented

◆ lockVertical

bool AC.GameCamera2D.lockVertical = true

If True, then vertical panning is prevented

◆ unitSnap

float AC.GameCamera2D.unitSnap = 0.1f

The step size when doSnapping is True