Antkeeper  0.0.1
Public Member Functions | List of all members
physics_system Class Reference

#include <physics-system.hpp>

Inheritance diagram for physics_system:
updatable_system

Public Member Functions

 physics_system (entity::registry &registry)
 
void update (float t, float dt) override
 Perform's a system's update() function. More...
 
void interpolate (float alpha)
 
void set_gravity (const math::fvec3 &gravity) noexcept
 Sets the gravity vector. More...
 
std::optional< std::tuple< entity::id, float, std::uint32_t, math::fvec3 > > trace (const geom::ray< float, 3 > &ray, entity::id ignore_eid=entt::null, std::uint32_t layer_mask=~std::uint32_t{0}) const
 Traces a ray to the nearest point of intersection. More...
 
- Public Member Functions inherited from updatable_system
 updatable_system (entity::registry &registry)
 Creates an updatable system. More...
 

Additional Inherited Members

- Protected Attributes inherited from updatable_system
entity::registryregistry
 Registry on which the system operate. More...
 

Detailed Description

Definition at line 38 of file physics-system.hpp.

Constructor & Destructor Documentation

◆ physics_system()

physics_system::physics_system ( entity::registry registry)
explicit

Definition at line 36 of file physics-system.cpp.

Member Function Documentation

◆ interpolate()

void physics_system::interpolate ( float  alpha)

Definition at line 93 of file physics-system.cpp.

◆ set_gravity()

void physics_system::set_gravity ( const math::fvec3 gravity)
inlinenoexcept

Sets the gravity vector.

Parameters
gravityGravity vector.

Definition at line 52 of file physics-system.hpp.

◆ trace()

std::optional< std::tuple< entity::id, float, std::uint32_t, math::fvec3 > > physics_system::trace ( const geom::ray< float, 3 > &  ray,
entity::id  ignore_eid = entt::null,
std::uint32_t  layer_mask = ~std::uint32_t{0} 
) const

Traces a ray to the nearest point of intersection.

Parameters
rayWorld-spce ray.
ignore_eidEntity ID with which to ignore intersection.
layer_maskMask of collision layers with which the ray can intersect.
Returns
Tuple containing the ID of the nearest intersecting entity, distance along the ray to the point of intersection, index of the hit face, and surface normal at the point of intersection; or std::nullopt if no intersection occurred.

Definition at line 112 of file physics-system.cpp.

◆ update()

void physics_system::update ( float  t,
float  dt 
)
overridevirtual

Perform's a system's update() function.

Parameters
tTotal elapsed time, in seconds.
dtDelta time, in seconds.

Implements updatable_system.

Definition at line 65 of file physics-system.cpp.


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