TheAtlasEngine
 
Loading...
Searching...
No Matches
atlas::physics::physics_context Class Referenceabstract

The context is the way to interact with specific backend context implementation such as JoltPhysics as our specific implementation-backend. More...

#include <physics_context.hpp>

Inheritance diagram for atlas::physics::physics_context:
atlas::physics::jolt_context

Public Member Functions

void destroy ()
 Performs cleanup when simulation stops.
 
void update (float p_delta_time)
 updates our simulation using delta time and works with a fixed timestep
 
void prepare ()
 As soon all physics bodies/colliders are created.
 
void add_box_collider (uint32_t p_entity_id, const transform *p_transform, const physics_body *p_body, const box_collider *p_collider)
 
void add_sphere_collider (uint32_t p_entity_id, const transform *p_transform, const physics_body *p_body, const sphere_collider *p_collider)
 
void add_capsule_collider (uint32_t p_entity_id, const transform *p_transform, const physics_body *p_body, const capsule_collider *p_collider)
 
transform read_transform (uint32_t p_id)
 
physics_body read_physics_body (uint32_t p_id)
 
void set_linear_velocity (uint64_t p_id, const glm::vec3 &p_linear_velocity)
 
void set_angular_velocity (uint64_t p_id, const glm::vec3 &p_angular_velocity)
 
void set_force (uint64_t p_id, const glm::vec3 &p_force)
 
void set_force_and_torque (uint64_t p_id, const glm::vec3 &p_force, const glm::vec3 &p_torque)
 
void set_impulse (uint64_t p_id, const glm::vec3 &p_impulse)
 

Private Member Functions

virtual void emplace_box_collider (uint32_t p_entity_id, const transform *p_transform, const physics_body *p_body, const box_collider *p_collider)=0
 Any emplace_* specific function are specific collider implementation-specific to the backend (context) API's they are implemented with.
 

Detailed Description

The context is the way to interact with specific backend context implementation such as JoltPhysics as our specific implementation-backend.

Provides API's to interact with the implemented physics context to run its simulation

Member Function Documentation

◆ add_box_collider()

void atlas::physics::physics_context::add_box_collider ( uint32_t  p_entity_id,
const transform p_transform,
const physics_body p_body,
const box_collider p_collider 
)
inline
Parameters
p_entity_idis the entity ID to associate with adding the sphere collider
p_transformprovide the location of the entity when creating this entity
p_physics_bodyprovide the actual physics body representation
p_colliderprovides the actual sphere collider

◆ add_capsule_collider()

void atlas::physics::physics_context::add_capsule_collider ( uint32_t  p_entity_id,
const transform p_transform,
const physics_body p_body,
const capsule_collider p_collider 
)
inline
Parameters
p_entity_idis the entity ID to associate with adding the sphere collider
p_transformprovide the location of the entity when creating this entity
p_physics_bodyprovide the actual physics body representation
p_colliderprovides the actual capsule collider

◆ add_sphere_collider()

void atlas::physics::physics_context::add_sphere_collider ( uint32_t  p_entity_id,
const transform p_transform,
const physics_body p_body,
const sphere_collider p_collider 
)
inline
Parameters
p_entity_idis the entity ID to associate with adding the sphere collider
p_transformprovide the location of the entity when creating this entity
p_physics_bodyprovide the actual physics body representation
p_colliderprovides the actual sphere collider

◆ destroy_bodies()

virtual void atlas::physics::physics_context::destroy_bodies ( )
privatepure virtual

◆ emplace_box_collider()

virtual void atlas::physics::physics_context::emplace_box_collider ( uint32_t  p_entity_id,
const transform p_transform,
const physics_body p_body,
const box_collider p_collider 
)
privatepure virtual

Any emplace_* specific function are specific collider implementation-specific to the backend (context) API's they are implemented with.

Since colliders have specific parameters that define them. It would simplify what parameter-access they have when adding these specific colliders to the physics system

Implemented in atlas::physics::jolt_context.

◆ prepare()

void atlas::physics::physics_context::prepare ( )
inline

As soon all physics bodies/colliders are created.

prepare() will be called to finalize all creation and apply them to the physics system for simulation

◆ read_physics_body()

physics_body atlas::physics::physics_context::read_physics_body ( uint32_t  p_id)
inline
Parameters
p_idis the entity ID that is required to specifiy which entity this transform in physics simulation to return to
Returns
physics body back to the entity after its modification

◆ read_transform()

transform atlas::physics::physics_context::read_transform ( uint32_t  p_id)
inline
Parameters
p_idis the entity ID that is required to specifiy which entity this transform in physics simulation to return to
Returns
transform back to the entity after its modification

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