Kemena3D
Loading...
Searching...
No Matches
kemena::kCharacterController Class Reference

Runtime wrapper around a Jolt character. More...

#include <kcharactercontroller.h>

Public Member Functions

 kCharacterController ()
 Constructs an uninitialised character controller; call init() before use.
 ~kCharacterController ()
 Destroys the controller, releasing any underlying Jolt character.
bool init (void *physicsSystem, const kCharacterControllerDesc &desc)
 Initialises the Jolt character.
void uninit ()
 Removes the character from the physics system.
void update (float deltaTime)
 Per-step maintenance (Jolt PostSimulation). Called by kPhysicsManager::update() after the world steps.
kVec3 getPosition () const
 Returns the character's current world-space position (capsule feet origin).
void setPosition (const kVec3 &position)
 Teleports the character to a world-space position.
kQuat getRotation () const
 Returns the character's current world-space orientation.
void setRotation (const kQuat &rotation)
 Sets the character's world-space orientation.
void setLinearVelocity (const kVec3 &velocity)
 Sets the character's world-space velocity (m/s).
kVec3 getLinearVelocity () const
 Returns the character's current world-space velocity (m/s).
bool isOnGround () const
 True when the character is standing on walkable ground.

Detailed Description

Runtime wrapper around a Jolt character.

Created by kPhysicsManager::createCharacter(); never instantiated directly by editor code. Call update() once per physics step (kPhysicsManager does this) and read getPosition() to drive the scene node.

Constructor & Destructor Documentation

◆ kCharacterController()

kemena::kCharacterController::kCharacterController ( )

Constructs an uninitialised character controller; call init() before use.

◆ ~kCharacterController()

kemena::kCharacterController::~kCharacterController ( )

Destroys the controller, releasing any underlying Jolt character.

Member Function Documentation

◆ getLinearVelocity()

kVec3 kemena::kCharacterController::getLinearVelocity ( ) const

Returns the character's current world-space velocity (m/s).

◆ getPosition()

kVec3 kemena::kCharacterController::getPosition ( ) const

Returns the character's current world-space position (capsule feet origin).

◆ getRotation()

kQuat kemena::kCharacterController::getRotation ( ) const

Returns the character's current world-space orientation.

◆ init()

bool kemena::kCharacterController::init ( void * physicsSystem,
const kCharacterControllerDesc & desc )

Initialises the Jolt character.

Parameters
physicsSystemOpaque JPH::PhysicsSystem* from kPhysicsManager.
descCapsule + motion parameters.
Returns
true on success.

◆ isOnGround()

bool kemena::kCharacterController::isOnGround ( ) const

True when the character is standing on walkable ground.

◆ setLinearVelocity()

void kemena::kCharacterController::setLinearVelocity ( const kVec3 & velocity)

Sets the character's world-space velocity (m/s).

Parameters
velocityDesired linear velocity in metres per second.

◆ setPosition()

void kemena::kCharacterController::setPosition ( const kVec3 & position)

Teleports the character to a world-space position.

Parameters
positionNew world-space position (capsule feet origin).

◆ setRotation()

void kemena::kCharacterController::setRotation ( const kQuat & rotation)

Sets the character's world-space orientation.

Parameters
rotationNew world-space orientation.

◆ uninit()

void kemena::kCharacterController::uninit ( )

Removes the character from the physics system.

◆ update()

void kemena::kCharacterController::update ( float deltaTime)

Per-step maintenance (Jolt PostSimulation). Called by kPhysicsManager::update() after the world steps.


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