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

Controls camera movement and rotation, inheriting from PlayerController. More...

#include <CameraController.h>

Inheritance diagram for clt::CameraController:
clt::PlayerController clt::Component clt::ICollisionListener

Public Member Functions

 CameraController (std::string pMovementCallback, std::string pVerticalMovementCallback, float pSpeed=2)
 Constructs a CameraController with specified movement callbacks and speed.
 
 ~CameraController ()=default
 Default destructor.
 
void Movement (Vector2 pDirection)
 Handles player movement in a given direction.
 
void MoveVertically (float pDirection)
 Handles vertical movement of the camera.
 
void Rotation (Vector2 pRotation)
 Handles camera rotation.
 
virtual void OnCollisionEnter (ColliderComponent *collider, const hitResult &result) override
 Called when a collision starts with another collider.
 
virtual void OnCollisionStay (ColliderComponent *collider, const hitResult &result) override
 Called while a collision is ongoing with another collider.
 
virtual void OnCollisionExit (ColliderComponent *collider, const hitResult &result) override
 Called when a collision ends with another collider.
 
virtual void OnTriggerEnter (ColliderComponent *collider, const hitResult &result) override
 Called when a trigger event starts with another collider.
 
virtual void OnTriggerStay (ColliderComponent *collider, const hitResult &result) override
 Called while a trigger event is ongoing with another collider.
 
virtual void OnTriggerExit (ColliderComponent *collider, const hitResult &result) override
 Called when a trigger event ends with another collider.
 
- Public Member Functions inherited from clt::PlayerController
 PlayerController (float pSpeed=2)
 Constructs a PlayerController with an optional movement speed.
 
 ~PlayerController ()=default
 Default destructor.
 
- Public Member Functions inherited from clt::Component
 Component (int pUpdateOrder=0)
 Constructor for Component.
 
virtual ~Component ()=default
 Virtual destructor for Component.
 
virtual void Start ()
 Called when the component is started.
 
virtual void Update ()
 Called every frame to update the 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 Member Functions inherited from clt::ICollisionListener
virtual ~ICollisionListener ()=default
 Virtual destructor for safe polymorphic destruction.
 

Additional Inherited Members

- Public Attributes inherited from clt::PlayerController
MovementMode mMovement
 Current movement mode of the player.
 
bool mIsJumping
 True if the player is currently jumping.
 
bool mIsMoving
 True if the player is currently moving.
 
bool mIsSprinting
 True if the player is currently sprinting.
 
bool mIsCrouched
 True if the player is currently crouched.
 
float mJumpHeight
 The height the player can jump.
 
int mJumpAmount
 The number of jumps the player can perform.
 
float mMaxWalkSpeed
 The maximum walking speed.
 
float mMaxSprintSpeed
 The maximum sprinting speed.
 
float mMaxAcceleration
 The maximum acceleration of the player.
 
float mAirControl
 The amount of control the player has while in the air.
 
Vector2 mMouseSpeed
 The speed of the mouse input.
 
- Public Attributes inherited from clt::Component
friend Actor
 
- 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

Controls camera movement and rotation, inheriting from PlayerController.

This component handles camera-specific movement, vertical movement, and rotation.

Constructor & Destructor Documentation

◆ CameraController()

CameraController::CameraController ( std::string pMovementCallback,
std::string pVerticalMovementCallback,
float pSpeed = 2 )

Constructs a CameraController with specified movement callbacks and speed.

Parameters
pMovementCallbackThe callback function name for movement.
pVerticalMovementCallbackThe callback function name for vertical movement.
pSpeedThe movement speed (default is 2).

Member Function Documentation

◆ Movement()

void CameraController::Movement ( Vector2 pDirection)

Handles player movement in a given direction.

Parameters
pDirectionThe direction vector for movement.

◆ MoveVertically()

void CameraController::MoveVertically ( float pDirection)

Handles vertical movement of the camera.

Parameters
pDirectionThe direction value for vertical movement.

◆ OnCollisionEnter()

virtual void clt::CameraController::OnCollisionEnter ( ColliderComponent * collider,
const hitResult & result )
inlineoverridevirtual

Called when a collision starts with another collider.

Parameters
colliderThe collider component involved in the collision.
resultThe hit result information.

Reimplemented from clt::PlayerController.

◆ OnCollisionExit()

virtual void clt::CameraController::OnCollisionExit ( ColliderComponent * collider,
const hitResult & result )
inlineoverridevirtual

Called when a collision ends with another collider.

Parameters
colliderThe collider component involved in the collision.
resultThe hit result information.

Reimplemented from clt::PlayerController.

◆ OnCollisionStay()

virtual void clt::CameraController::OnCollisionStay ( ColliderComponent * collider,
const hitResult & result )
inlineoverridevirtual

Called while a collision is ongoing with another collider.

Parameters
colliderThe collider component involved in the collision.
resultThe hit result information.

Reimplemented from clt::PlayerController.

◆ OnTriggerEnter()

virtual void clt::CameraController::OnTriggerEnter ( ColliderComponent * collider,
const hitResult & result )
inlineoverridevirtual

Called when a trigger event starts with another collider.

Parameters
colliderThe collider component involved in the trigger.
resultThe hit result information.

Reimplemented from clt::PlayerController.

◆ OnTriggerExit()

virtual void clt::CameraController::OnTriggerExit ( ColliderComponent * collider,
const hitResult & result )
inlineoverridevirtual

Called when a trigger event ends with another collider.

Parameters
colliderThe collider component involved in the trigger.
resultThe hit result information.

Reimplemented from clt::PlayerController.

◆ OnTriggerStay()

virtual void clt::CameraController::OnTriggerStay ( ColliderComponent * collider,
const hitResult & result )
inlineoverridevirtual

Called while a trigger event is ongoing with another collider.

Parameters
colliderThe collider component involved in the trigger.
resultThe hit result information.

Reimplemented from clt::PlayerController.

◆ Rotation()

void CameraController::Rotation ( Vector2 pRotation)

Handles camera rotation.

Parameters
pRotationThe rotation vector.

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