Anvil Engine
Loading...
Searching...
No Matches
AnvilPhysics Class Reference

A physics system class using ReactPhysics3D engine for physics simulation. More...

#include <AnvilPhysics.h>

Public Member Functions

 AnvilPhysics ()
 Constructor for AnvilPhysics.
 ~AnvilPhysics ()
 Destructor for AnvilPhysics.
void Update (float dt)
 Update the physics simulation.
ABodyCreateBody (glm::vec3 pos, glm::vec3 size, float mass, bool isStatic)
void SetWorldData (const std::vector< AVertex > &verts, const std::vector< AFace > &faces)
RaycastHit CastRay (glm::vec3 origin, glm::vec3 direction, float maxDistance, const std::vector< AEntity * > &entities)
bool IsGrounded (ABody *body)
void AddTrigger (glm::vec3 pos, glm::vec3 size, std::string name)
void SetWorldPlanes (const std::vector< APlane > &planes)
void SetWorldBrushes (const std::vector< ABSPBrush > &brushes)
void OnTrigger (const std::string &name)
void SetBodyMaterial (ABody *body, float bounciness, float friction)

Static Public Member Functions

static reactphysics3d::Vector3 toRP3D (const glm::vec3 &v)
static glm::vec3 toGlm (const reactphysics3d::Vector3 &v)

Detailed Description

A physics system class using ReactPhysics3D engine for physics simulation.

Constructor & Destructor Documentation

◆ AnvilPhysics()

AnvilPhysics::AnvilPhysics ( )

Constructor for AnvilPhysics.

Constructor for AnvilPhysics class Initializes the physics engine and sets up the world with contact listener

◆ ~AnvilPhysics()

AnvilPhysics::~AnvilPhysics ( )

Destructor for AnvilPhysics.

Destructor for AnvilPhysics class Cleans up all physics-related resources including rigid bodies, triangle meshes, physics world, and contact listener

Member Function Documentation

◆ AddTrigger()

void AnvilPhysics::AddTrigger ( glm::vec3 pos,
glm::vec3 size,
std::string name )

◆ CastRay()

RaycastHit AnvilPhysics::CastRay ( glm::vec3 origin,
glm::vec3 direction,
float maxDistance,
const std::vector< AEntity * > & entities )

◆ CreateBody()

ABody * AnvilPhysics::CreateBody ( glm::vec3 pos,
glm::vec3 size,
float mass,
bool isStatic )

◆ IsGrounded()

bool AnvilPhysics::IsGrounded ( ABody * body)

Checks if a given body is grounded by casting a ray downward from its position

Parameters
bodyThe body to check if it's grounded
Returns
Returns true if the body is grounded, false otherwise

◆ OnTrigger()

void AnvilPhysics::OnTrigger ( const std::string & name)

◆ SetBodyMaterial()

void AnvilPhysics::SetBodyMaterial ( ABody * body,
float bounciness,
float friction )

◆ SetWorldBrushes()

void AnvilPhysics::SetWorldBrushes ( const std::vector< ABSPBrush > & brushes)
inline

◆ SetWorldData()

void AnvilPhysics::SetWorldData ( const std::vector< AVertex > & verts,
const std::vector< AFace > & faces )

Sets up the physics world data from vertex and face information

Parameters
vertsVector of vertices defining the mesh
facesVector of faces defining the mesh connectivity

◆ SetWorldPlanes()

void AnvilPhysics::SetWorldPlanes ( const std::vector< APlane > & planes)
inline

◆ toGlm()

glm::vec3 AnvilPhysics::toGlm ( const reactphysics3d::Vector3 & v)
static

◆ toRP3D()

Vector3 AnvilPhysics::toRP3D ( const glm::vec3 & v)
static

◆ Update()

void AnvilPhysics::Update ( float dt)

Update the physics simulation.

Parameters
dtDelta time for physics update

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