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

Public Member Functions

void CentreToCamera ()
 

Public Attributes

_Camera cameraToAlignTo
 
bool lockDistance = true
 
float distanceToCamera
 
bool lockScale
 
Vector2 scaleFactor = Vector2.zero
 
AlignType alignType = AlignType.YAxisOnly
 

Protected Member Functions

void Awake ()
 
void Update ()
 
void Align ()
 
void CalculateScale ()
 

Detailed Description

Aligns an object to a camera's viewport. This is intended for sprites being used as foreground objects in 2.5D games.

Member Function Documentation

◆ CentreToCamera()

void AC.AlignToCamera.CentreToCamera ( )

Attempts to place the GameObject in the centre of cameraToAlignTo's view.

Member Data Documentation

◆ alignType

AlignType AC.AlignToCamera.alignType = AlignType.YAxisOnly

How the object is aligned (YAxisOnly, CopyFullRotation)

◆ cameraToAlignTo

_Camera AC.AlignToCamera.cameraToAlignTo

The _Camera to align the GameObject to

◆ distanceToCamera

float AC.AlignToCamera.distanceToCamera

How far to place the GameObject away from the cameraToAlignTo, once set

◆ lockDistance

bool AC.AlignToCamera.lockDistance = true

If True, the distance from the camera will be fixed (though adjustable in the Inspector)

◆ lockScale

bool AC.AlignToCamera.lockScale

If True, the percieved scale of the GameObject, as seen through the cameraToAlignTo, will be fixed even if the distance between the two changes

◆ scaleFactor

Vector2 AC.AlignToCamera.scaleFactor = Vector2.zero

If lockScale is True, this GameObject's scale will be multiplied by this value