27#include "Utils/CSingleton.h"
28#include "Transform/CTransformMatrix.h"
29#include "CPhysicsRaycast.h"
30#include "CDrawDebug.h"
32#ifdef USE_BULLET_PHYSIC_ENGINE
33#include <btBulletCollisionCommon.h>
34#include <btBulletDynamicsCommon.h>
35#include <BulletDynamics/Character/btKinematicCharacterController.h>
53#ifdef USE_BULLET_PHYSIC_ENGINE
54 btRigidBody* BulletBody;
66#ifdef USE_BULLET_PHYSIC_ENGINE
67 btKinematicCharacterController* BulletCharacter;
68 btPairCachingGhostObject* GhostObject;
115 friend class CRigidbody;
116 friend class CCharacterController;
127#ifdef USE_BULLET_PHYSIC_ENGINE
128 btOverlappingPairCallback* m_overlapCB;
129 btBroadphaseInterface* m_broadphase;
130 btCollisionDispatcher* m_dispatcher;
131 btConstraintSolver* m_solver;
132 btDefaultCollisionConfiguration* m_collisionConfiguration;
133 btDiscreteDynamicsWorld* m_dynamicsWorld;
135 CDrawDebug* m_drawDebug;
142 bool m_enableDrawDebug;
147 virtual ~CPhysicsEngine();
247#ifdef USE_BULLET_PHYSIC_ENGINE
248 inline btDiscreteDynamicsWorld* getDynamicsWorld()
250 return m_dynamicsWorld;
253 void addBody(CRigidbody* body);
255 void removeBody(CRigidbody* body);
257 void addCharacter(CCharacterController* character);
259 void removeCharacter(CCharacterController* character);
261 void syncTransforms();
263 void checkCollision();
A kinematic character controller for handling player movement.
Definition CCharacterController.h:69
bool rayTest(const core::vector3df &from, const core::vector3df &to, SClosestRaycastResult &result)
Performs a raycast test returning only the closest hit.
bool IsInEditor
Indicates if the engine is running within the editor.
Definition CPhysicsEngine.h:124
bool isInitialized()
Checks if the physics engine has been initialized.
core::array< SRigidbodyData * > & getBodies()
Gets all registered rigid bodies.
Definition CPhysicsEngine.h:231
void updatePhysics(float timestepSec, int step=1)
Steps the physics simulation.
void syncTransformToPhysics()
Synchronizes Skylicht transforms to the physics engine.
void initPhysics()
Initializes the physics world and configuration.
void exitPhysics()
Cleans up and releases physics world resources.
void setGravity(float g)
Sets the gravity on the Y-axis.
core::array< SCharacterData * > & getCharacters()
Gets all registered character controllers.
Definition CPhysicsEngine.h:240
bool rayTest(const core::vector3df &from, const core::vector3df &to, SAllRaycastResult &result)
Performs a raycast test returning all hits.
void debugDrawWorld()
Draws the physics world for debugging.
void updateAABBs()
Updates the Axis-Aligned Bounding Boxes (AABBs) for all objects.
void enableDrawDebug(bool b, bool alwayDraw=false)
Enables or disables physics debug visualization.
float getGravity()
Gets the current gravity value.
Definition CPhysicsEngine.h:193
Represents a physical rigid body in the physics simulation.
Definition CRigidbody.h:77
Self reallocating template array (like stl vector) with additional features.
Definition irrArray.h:23
#define DECLARE_SINGLETON(className)
Declare the standard singleton accessors for a class.
Definition CSingleton.h:36
Everything in the Skylicht Engine. You can start by looking at the topics.
Definition AudioDebugLog.h:29
vector3d< f32 > vector3df
Typedef for a f32 3d vector.
Definition vector3d.h:445
Result structure for a raycast that returns all hits.
Definition CPhysicsRaycast.h:39
Data structure for managing character controller within the physics engine.
Definition CPhysicsEngine.h:63
Result structure for a raycast that returns only the closest hit.
Definition CPhysicsRaycast.h:56
Data structure for managing rigid body within the physics engine.
Definition CPhysicsEngine.h:50