![]() |
Skylicht Engine
|
A kinematic character controller for handling player movement. More...
#include <CharacterController/CCharacterController.h>
Public Member Functions | |
| virtual void | initComponent () |
| virtual void | startComponent () |
| virtual void | updateComponent () |
| virtual void | setCollisionGroupAndFilter (int group, int filter) |
| Sets the collision group and filter mask. | |
| bool | initCharacter (float stepHeight) |
| Initializes the character controller in the physics world. | |
| void | releaseCharacter () |
| Releases the character controller from the physics world. | |
| core::vector3df | getPosition () |
| Gets the current world position of the character. | |
| void | setPosition (const core::vector3df &pos) |
| Sets the world position of the character. | |
| core::vector3df | getRotationEuler () |
| Gets the world rotation as Euler angles. | |
| core::quaternion | getRotation () |
| Gets the world rotation as a quaternion. | |
| void | setRotation (const core::vector3df &eulerDeg) |
| Sets the world rotation using Euler angles. | |
| void | setRotation (const core::quaternion &q) |
| Sets the world rotation using a quaternion. | |
| void | syncTransform () |
| Synchronizes the GameObject's transform with the character's physics transform. | |
| void | setWalkDirection (const core::vector3df &walk) |
| Sets the direction and speed the character should walk. | |
| bool | canJump () |
| Checks if the character is in a state where it can jump. | |
| bool | onGround () |
| Checks if the character is currently on the ground. | |
| void | setMaxSlope (float slopeRadians) |
| Sets the maximum slope the character can walk up. | |
| float | getMaxSlope () const |
| Gets the maximum slope angle. | |
| void | setMaxPenetrationDepth (float d) |
| Sets the maximum depth the character can penetrate other objects before collision response. | |
| float | getMaxPenetrationDepth () const |
| Gets the maximum penetration depth. | |
| void | reset () |
| Resets the character controller's state and position in the dynamics world. | |
| void | setStepHeight (float h) |
| Sets the step height for the character. | |
| float | getStepHeight () const |
| Gets the current step height. | |
| void | setFallSpeed (float fallSpeed) |
| Sets the maximum falling speed. | |
| float | getFallSpeed () const |
| Gets the maximum falling speed. | |
| void | setJumpSpeed (float jumpSpeed) |
| Sets the initial speed when jumping. | |
| float | getJumpSpeed () const |
| Gets the initial jump speed. | |
| void | setMaxJumpHeight (float maxJumpHeight) |
| Sets the maximum height the character can jump. | |
| void | jump (const core::vector3df &v) |
| Triggers a jump with an optional initial velocity. | |
| void | setGravity (const core::vector3df &gravity) |
| Sets the custom gravity for this character. | |
| core::vector3df | getGravity () const |
| Gets the custom gravity of the character. | |
| void | applyImpulse (const core::vector3df &v) |
| Applies an instantaneous impulse (wraps jump). | |
| void | setAngularVelocity (const core::vector3df &velocity) |
| Sets the angular velocity of the character. | |
| core::vector3df | getAngularVelocity () const |
| Gets the angular velocity. | |
| void | setLinearVelocity (const core::vector3df &velocity) |
| Sets the linear velocity of the character. | |
| core::vector3df | getLinearVelocity () const |
| Gets the linear velocity. | |
| void | setLinearDamping (float d) |
| Sets the linear damping coefficient. | |
| float | getLinearDamping () const |
| Gets the linear damping coefficient. | |
| void | setAngularDamping (float d) |
| Sets the angular damping coefficient. | |
| float | getAngularDamping () const |
| Gets the angular damping coefficient. | |
| void | setUp (const core::vector3df &up) |
| Sets the 'up' direction for the character. | |
| core::vector3df | getUp () |
| Gets the 'up' direction. | |
| Public Member Functions inherited from Skylicht::Physics::ICollisionObject | |
| ECollisionType | getCollisionType () |
| Gets the collision type. | |
| int | getCollisionGroup () |
| Gets the collision group bitmask. | |
| int | getCollisionFilter () |
| Gets the collision filter bitmask. | |
| Public Member Functions inherited from Skylicht::CComponentSystem | |
| const char * | getName () |
| virtual void | endUpdate () |
| virtual void | onEnable (bool b) |
| virtual void | onUpdateCullingLayer (u32 mask) |
| virtual CObjectSerializable * | createSerializable () |
| virtual void | loadSerializable (CObjectSerializable *object) |
| void | setEnable (bool b) |
| bool | isEnable () |
| CGameObject * | getGameObject () |
| void | setEnableSerializable (bool b) |
| bool | isSerializable () |
| void | addLinkComponent (CComponentSystem *comp) |
| void | removeAllLink () |
| Public Member Functions inherited from Skylicht::IActivatorObject | |
| virtual | ~IActivatorObject () |
| Virtual destructor for polymorphic activator objects. | |
Friends | |
| class | CPhysicsEngine |
Additional Inherited Members | |
| Public Types inherited from Skylicht::Physics::ICollisionObject | |
| enum | ECollisionType { Unknown , RigidBody , Character } |
| Types of collision objects. | |
| Static Public Member Functions inherited from Skylicht::CComponentSystem | |
| static int | useComponent (CComponentSystem *used) |
| Public Attributes inherited from Skylicht::Physics::ICollisionObject | |
| std::function< void(ICollisionObject *, ICollisionObject *, SCollisionContactPoint *, int)> | OnCollision |
| Callback function triggered when a collision occurs. | |
| Protected Member Functions inherited from Skylicht::CComponentSystem | |
| void | setOwner (CGameObject *obj) |
| Protected Attributes inherited from Skylicht::Physics::ICollisionObject | |
| ECollisionType | m_collisionType |
| int | m_group |
| int | m_filter |
| Protected Attributes inherited from Skylicht::CComponentSystem | |
| CGameObject * | m_gameObject |
| bool | m_enable |
| bool | m_serializable |
| std::vector< CComponentSystem * > | m_linkComponent |
A kinematic character controller for handling player movement.
This component provides functionality for walking, jumping, and interacting with the physics world through a ghost object and a kinematic controller (btKinematicCharacterController).
Example: Setting up a player character
|
inline |
Applies an instantaneous impulse (wraps jump).
| v | Impulse vector. |
| bool Skylicht::Physics::CCharacterController::canJump | ( | ) |
Checks if the character is in a state where it can jump.
| float Skylicht::Physics::CCharacterController::getAngularDamping | ( | ) | const |
Gets the angular damping coefficient.
| core::vector3df Skylicht::Physics::CCharacterController::getAngularVelocity | ( | ) | const |
Gets the angular velocity.
| float Skylicht::Physics::CCharacterController::getFallSpeed | ( | ) | const |
Gets the maximum falling speed.
| core::vector3df Skylicht::Physics::CCharacterController::getGravity | ( | ) | const |
Gets the custom gravity of the character.
| float Skylicht::Physics::CCharacterController::getJumpSpeed | ( | ) | const |
Gets the initial jump speed.
| float Skylicht::Physics::CCharacterController::getLinearDamping | ( | ) | const |
Gets the linear damping coefficient.
| core::vector3df Skylicht::Physics::CCharacterController::getLinearVelocity | ( | ) | const |
Gets the linear velocity.
| float Skylicht::Physics::CCharacterController::getMaxPenetrationDepth | ( | ) | const |
Gets the maximum penetration depth.
| float Skylicht::Physics::CCharacterController::getMaxSlope | ( | ) | const |
Gets the maximum slope angle.
| core::vector3df Skylicht::Physics::CCharacterController::getPosition | ( | ) |
Gets the current world position of the character.
| core::quaternion Skylicht::Physics::CCharacterController::getRotation | ( | ) |
Gets the world rotation as a quaternion.
| core::vector3df Skylicht::Physics::CCharacterController::getRotationEuler | ( | ) |
Gets the world rotation as Euler angles.
| float Skylicht::Physics::CCharacterController::getStepHeight | ( | ) | const |
Gets the current step height.
| core::vector3df Skylicht::Physics::CCharacterController::getUp | ( | ) |
Gets the 'up' direction.
| bool Skylicht::Physics::CCharacterController::initCharacter | ( | float | stepHeight | ) |
Initializes the character controller in the physics world.
| stepHeight | The maximum height of steps the character can walk over. |
|
virtual |
Implements Skylicht::CComponentSystem.
| void Skylicht::Physics::CCharacterController::jump | ( | const core::vector3df & | v | ) |
Triggers a jump with an optional initial velocity.
| v | Initial jump velocity (optional). |
| bool Skylicht::Physics::CCharacterController::onGround | ( | ) |
Checks if the character is currently on the ground.
|
virtual |
Resets the character controller's state and position in the dynamics world.
Reimplemented from Skylicht::CComponentSystem.
| void Skylicht::Physics::CCharacterController::setAngularDamping | ( | float | d | ) |
Sets the angular damping coefficient.
| d | Damping value. |
| void Skylicht::Physics::CCharacterController::setAngularVelocity | ( | const core::vector3df & | velocity | ) |
Sets the angular velocity of the character.
| velocity | Angular velocity vector. |
|
virtual |
Sets the collision group and filter mask.
| group | Bitmask representing the collision group. |
| filter | Bitmask representing which groups this object should collide with. |
Reimplemented from Skylicht::Physics::ICollisionObject.
| void Skylicht::Physics::CCharacterController::setFallSpeed | ( | float | fallSpeed | ) |
Sets the maximum falling speed.
| fallSpeed | Fall speed value. |
| void Skylicht::Physics::CCharacterController::setGravity | ( | const core::vector3df & | gravity | ) |
Sets the custom gravity for this character.
| gravity | Gravity vector. |
| void Skylicht::Physics::CCharacterController::setJumpSpeed | ( | float | jumpSpeed | ) |
Sets the initial speed when jumping.
| jumpSpeed | Jump speed value. |
| void Skylicht::Physics::CCharacterController::setLinearDamping | ( | float | d | ) |
Sets the linear damping coefficient.
| d | Damping value. |
| void Skylicht::Physics::CCharacterController::setLinearVelocity | ( | const core::vector3df & | velocity | ) |
Sets the linear velocity of the character.
| velocity | Linear velocity vector. |
| void Skylicht::Physics::CCharacterController::setMaxJumpHeight | ( | float | maxJumpHeight | ) |
Sets the maximum height the character can jump.
| maxJumpHeight | Max jump height. |
| void Skylicht::Physics::CCharacterController::setMaxPenetrationDepth | ( | float | d | ) |
Sets the maximum depth the character can penetrate other objects before collision response.
| d | Penetration depth. |
| void Skylicht::Physics::CCharacterController::setMaxSlope | ( | float | slopeRadians | ) |
Sets the maximum slope the character can walk up.
| slopeRadians | Slope angle in radians. |
| void Skylicht::Physics::CCharacterController::setPosition | ( | const core::vector3df & | pos | ) |
Sets the world position of the character.
| pos | Position vector. |
| void Skylicht::Physics::CCharacterController::setRotation | ( | const core::quaternion & | q | ) |
Sets the world rotation using a quaternion.
| q | Rotation quaternion. |
| void Skylicht::Physics::CCharacterController::setRotation | ( | const core::vector3df & | eulerDeg | ) |
Sets the world rotation using Euler angles.
| eulerDeg | Euler angles in degrees. |
| void Skylicht::Physics::CCharacterController::setStepHeight | ( | float | h | ) |
Sets the step height for the character.
| h | Step height. |
| void Skylicht::Physics::CCharacterController::setUp | ( | const core::vector3df & | up | ) |
Sets the 'up' direction for the character.
| up | Up direction vector. |
| void Skylicht::Physics::CCharacterController::setWalkDirection | ( | const core::vector3df & | walk | ) |
Sets the direction and speed the character should walk.
| walk | Velocity vector for walking. |
|
virtual |
Reimplemented from Skylicht::CComponentSystem.
|
virtual |
Implements Skylicht::CComponentSystem.