Clutter Engine 0.0.1
Loading...
Searching...
No Matches
clt::SpringArmComponent Class Reference

A component that maintains a camera at a fixed distance from its parent, with optional lag and rotation smoothing. More...

#include <SpringArmComponent.h>

Inheritance diagram for clt::SpringArmComponent:
clt::Component

Public Member Functions

 SpringArmComponent (Actor *pCamera, float pLagSpeed=3.0f, int pUpdateOrder=0)
 Constructs a SpringArmComponent with a camera actor.
 
 SpringArmComponent (CameraComponent *camera, float pLagSpeed=3.0f, int pUpdateOrder=0)
 Constructs a SpringArmComponent with a camera component.
 
 SpringArmComponent (float pLagSpeed=3.0f, int pUpdateOrder=0)
 Constructs a SpringArmComponent with default parameters.
 
 ~SpringArmComponent ()=default
 Destructor for SpringArmComponent.
 
void Start () override
 Called when the component is started.
 
void Update () override
 Updates the spring arm each frame.
 
- Public Member Functions inherited from clt::Component
 Component (int pUpdateOrder=0)
 Constructor for Component.
 
virtual ~Component ()=default
 Virtual destructor for Component.
 
virtual void Destroy ()
 Called to destroy the component.
 
void SetActive (bool pActive)
 Enables or disables the component.
 
void OnDestroy ()
 Called when the component is destroyed.
 
bool IsActive () const
 Checks if the component is enabled.
 
int GetUpdateOrder () const
 Gets the update order of the component.
 
void SetRelativeLocation (const Vector3 &loc)
 Sets the relative location of the component.
 
void SetRelativeLocation (const Vector2 &loc)
 Sets the relative location of the component.
 
void SetWorldLocation (const Vector3 &loc)
 Sets the world location of the component.
 
void SetRelativeScale (const Vector3 &scale)
 Sets the relative scale of the component.
 
void SetRelativeScale (const Vector2 &scale)
 Sets the relative scale of the component.
 
void SetRelativeRotation (Quaternion rot)
 Sets the relative rotation of the component.
 
void SetRelativeRotation (Vector3 rot)
 Sets the relative rotation of the component.
 
void SetWorldRotation (const Quaternion &rot)
 Sets the world rotation of the component.
 
void SetWorldRotation (const Vector3 &rot)
 Sets the world rotation of the component.
 
void AddRelativeRotation (Vector3 rot)
 Adds a rotation to the current relative rotation.
 
void SetRelativeRotation (float rot)
 Sets the relative rotation of the component.
 
void SetRelativeTransform (Transform &transform)
 Sets the relative transform of the component.
 
Vector3 GetRelativeLocation () const
 Gets the relative location of the component.
 
Vector3 GetRelativeScale () const
 Gets the relative scale of the component.
 
Quaternion GetRelativeRotation () const
 Gets the relative rotation of the component.
 
Vector3 GetRelativeRotationEuler () const
 Gets the relative rotation of the component as Euler angles.
 
Transform GetRelativeTransform () const
 Gets the relative transform of the component.
 
Vector3 GetWorldLocation () const
 Gets the world location of the component.
 
Vector3 GetWorldScale () const
 Gets the world scale of the component.
 
Quaternion GetWorldRotation () const
 Gets the world rotation of the component.
 
virtual Transform GetWorldTransform () const
 Gets the world transform of the component.
 
ActorGetOwner () const
 Gets the owner actor of this component.
 

Public Attributes

float mLagSpeed
 The speed at which the camera arm lags behind the target.
 
float mLagMaxDistance
 The maximum distance the camera arm can lag behind the target.
 
float mRotationLagSpeed
 The speed at which the camera arm's rotation lags behind the target's rotation.
 
Vector3 mCameraOffset
 The offset of the camera from the end of the spring arm.
 
float mArmLength
 The length of the spring arm.
 
- Public Attributes inherited from clt::Component
friend Actor
 

Additional Inherited Members

- Protected Member Functions inherited from clt::Component
virtual void SetOwner (Actor *pOwner)
 Sets the owner of this component and calls Start().
 
bool LineTrace (Vector3 start, Vector3 direction, float maxDistance, raycastHit &hit, bool debugPersistant=false)
 Performs a line trace (raycast) using the owning actor.
 
- Protected Attributes inherited from clt::Component
bool mIsActive = true
 Indicates if the component is active.
 
int mUpdateOrder = 0
 The order in which the component is updated.
 
ActormOwner
 The actor that owns this component.
 
Transform mRelativeTransform
 The relative transform of the component to its owner.
 

Detailed Description

A component that maintains a camera at a fixed distance from its parent, with optional lag and rotation smoothing.

Constructor & Destructor Documentation

◆ SpringArmComponent() [1/3]

SpringArmComponent::SpringArmComponent ( Actor * pCamera,
float pLagSpeed = 3.0f,
int pUpdateOrder = 0 )

Constructs a SpringArmComponent with a camera actor.

Parameters
pCameraThe actor that owns the camera.
pLagSpeedThe speed at which the arm lags behind the target.
pUpdateOrderThe update order for the component.

◆ SpringArmComponent() [2/3]

SpringArmComponent::SpringArmComponent ( CameraComponent * camera,
float pLagSpeed = 3.0f,
int pUpdateOrder = 0 )

Constructs a SpringArmComponent with a camera component.

Parameters
cameraThe camera component to attach.
pLagSpeedThe speed at which the arm lags behind the target.
pUpdateOrderThe update order for the component.

◆ SpringArmComponent() [3/3]

clt::SpringArmComponent::SpringArmComponent ( float pLagSpeed = 3.0f,
int pUpdateOrder = 0 )

Constructs a SpringArmComponent with default parameters.

Parameters
pLagSpeedThe speed at which the arm lags behind the target.
pUpdateOrderThe update order for the component.

Member Function Documentation

◆ Start()

void SpringArmComponent::Start ( )
overridevirtual

Called when the component is started.

Reimplemented from clt::Component.

◆ Update()

void SpringArmComponent::Update ( )
overridevirtual

Updates the spring arm each frame.

Reimplemented from clt::Component.


The documentation for this class was generated from the following files: