3#include <btBulletDynamicsCommon.h>
4#include <glm/mat4x4.hpp>
31 btCollisionShape*
shape =
nullptr;
79 const glm::vec3& origin,
80 const glm::vec3& direction,
110 static btCollisionShape *
createPlaneShape(
const glm::vec3& surfaceNormal,
float distanceFromOrigin);
129 const std::vector<glm::vec3>& vertices,
130 const std::vector<uint32_t>& indices,
131 btTriangleMesh*& triangleMeshOut);
bool raycastClosest(const glm::vec3 &origin, const glm::vec3 &direction, float maxDistance, Physics::RaycastHit &outHit) const
Casts a ray through the physics world and returns the closest hit, if any.
btCollisionDispatcher * dispatcher
void debugDrawAll() const
Draws debug visualization of all collision shapes in the world.
btConstraintSolver * solver
btRigidBody * createRigidBody(const Physics::RigidBodyCreateInfo &info) const
Creates a rigid body for the physics simulation.
static btCollisionShape * createConvexHullShape(const std::vector< glm::vec3 > &vertices)
Creates a convex hull collision shape from a set of vertices.
btDiscreteDynamicsWorld * getDynamicsWorld() const
Gets the world where the physics simulation is performed inside.
static btCollisionShape * createCapsuleShape(float radius, float height)
creates a capsule with a height and a radius.
static btCollisionShape * createPlaneShape(const glm::vec3 &surfaceNormal, float distanceFromOrigin)
Creates a plane from.
btCollisionConfiguration * collisionConfiguration
void update(float deltaTimeSeconds)
Steps the physics simulation by 1/120th of a second. The idea of the engine is that it should run on ...
btBroadphaseInterface * broadphase
void removeRigidBody(btRigidBody *body) const
Removes a rigid body from the physics simulation.
static btCollisionShape * createBoxShape(const glm::vec3 &halfExtents)
Creates a collision box.
void onPhysicsComponentDestroyed(entt::registry ®istry, entt::entity entity)
Cleans up the hit box pointers and motion state if applicable.
static btCompoundShape * createCompoundShape()
Creates an empty compound shape for combining multiple collision shapes.
static btCollisionShape * createSphereShape(float radius)
Creates a collision sphere.
static btCollisionShape * createTriangleMeshShape(const std::vector< glm::vec3 > &vertices, const std::vector< uint32_t > &indices, btTriangleMesh *&triangleMeshOut)
Creates a triangle mesh collision shape from vertices and indices.
btDiscreteDynamicsWorld * dynamicsWorld
Core audio subsystem owning the miniaudio engine and managing playback.
const btCollisionObject * collisionObject
Rigid body create info is used to create a rigid body. It delivers all informations like the initial ...
btCollisionShape * shape
pointer to the collision shape
float friction
friction 0.0f - 1.0f. 0 is ice 0.3f - 0.5f wood or plastic. 0.7f - 1.0f High friction
float restitution
energy absorption 0.0f means full absorption on impact, 0.5f half of the energy is maintained after i...
glm::mat4 transform
initial location for the rigid body
float mass
mass in Kilograms. Mass of 0 is a static object --> immovable