Claire's Game Engine
Full C++ Engine using OpenGL
Loading...
Searching...
No Matches
PlayerController Class Reference

#include <PlayerController.h>

Inheritance diagram for PlayerController:
MoveComponent IInputListener Component

Public Member Functions

 PlayerController (Actor *pActor)
 
void OnNotify (SDL_Event &pEvent) override
 Called when an input event occurs.
 
- Public Member Functions inherited from MoveComponent
 MoveComponent (Actor *pOwner, int pUpdateOrder=100)
 Constructor for MoveComponent.
 
 MoveComponent ()=delete
 
 MoveComponent (const MoveComponent &)=delete
 
MoveComponentoperator= (const MoveComponent &)=delete
 
Vector3 GetSpeed () const
 Gets the current speed of the actor.
 
void SetSpeed (Vector3 pSpeed)
 Sets the actor's speed.
 
void AddForce (Vector3 pForce)
 Adds a force to the actor's velocity.
 
Vector2 GetRotationSpeed () const
 Gets the current rotation speed of the actor.
 
void SetRotationSpeed (Vector2 pRotationSpeed)
 Sets the rotation speed of the actor.
 
virtual void Update () override
 Updates the position, rotation, and velocity of the actor each frame. Applies gravity, friction, rotation, and checks for collisions.
 
virtual Vector3 GetDesiredPos ()
 Computes the desired position of the actor after applying speed and velocity. Also handles collision detection along the X, Y, and Z axes.
 
void SetCollider (ColliderComponent *pCollider)
 Sets the collider for collision detection.
 
ColliderComponentCheckCollision ()
 Checks for a collision with other colliders in the scene. If a collision is detected, applies a simple collision response.
 
- Public Member Functions inherited from Component
 Component (Actor *pOwner, int pUpdateOrder=100)
 Constructor for Component.
 
virtual ~Component ()
 
virtual void OnStart ()
 Called when the component is initialized (during actor start). This can be used to perform any setup operations for the component.
 
virtual void OnEnd ()
 Called when the component is about to be destroyed (during actor destruction). This can be used to clean up or release any resources.
 
virtual void OnUpdateWorldTrandform ()
 Called when the world transform of the actor is updated. This allows the component to react to changes in the actor's world transform.
 
void SetActive (bool isActive)
 Sets the active status of the component.
 
void SetOwner (Actor *pOwner)
 Sets the actor that owns this component.
 
int GetUpdateOrder () const
 Returns the update order of the component. Components with lower update orders are updated first.
 
ActorGetOwner () const
 Returns the actor that owns this component.
 
- Public Member Functions inherited from IInputListener
virtual ~IInputListener ()=default
 

Additional Inherited Members

- Public Attributes inherited from MoveComponent
Vector3 mGravityDirection = Vector3::Zero
 Direction of gravity applied to the actor. Default is a zero vector (no gravity).
 
Vector3 mVelocity = Vector3::Zero
 Current velocity of the actor in 3D space.
 
float mFriction = 0.8f
 Friction coefficient applied to velocity each update.
 
- Protected Attributes inherited from MoveComponent
Vector3 mSpeed = 0
 Speed of the actor in 3D space (can be adjusted to control movement).
 
Vector2 mRotationSpeed = 0
 Rotation speed of the actor (yaw and pitch).
 
- Protected Attributes inherited from Component
ActormOwner = nullptr
 The actor that owns this component.
 

Constructor & Destructor Documentation

◆ PlayerController()

PlayerController::PlayerController ( Actor * pActor)

Member Function Documentation

◆ OnNotify()

void PlayerController::OnNotify ( SDL_Event & pEvent)
overridevirtual

Called when an input event occurs.

Parameters
pEventReference to the SDL_Event received from the input system.

Implements IInputListener.


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