20 #ifndef ANTKEEPER_GAME_PHYSICS_SYSTEM_HPP
21 #define ANTKEEPER_GAME_PHYSICS_SYSTEM_HPP
24 #include <entt/entt.hpp>
43 void update(
float t,
float dt)
override;
54 this->gravity = gravity;
66 [[nodiscard]] 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;
71 void integrate(
float dt);
73 void solve_constraints(
float dt);
75 void detect_collisions_broad();
76 void detect_collisions_narrow();
77 void resolve_collisions();
78 void correct_positions();
104 std::vector<std::pair<physics::rigid_body*, physics::rigid_body*>> broad_phase_pairs;
105 std::vector<collision_manifold_type> narrow_phase_manifolds;
void set_gravity(const math::fvec3 &gravity) noexcept
Sets the gravity vector.
void interpolate(float alpha)
void update(float t, float dt) override
Perform's a system's update() function.
physics_system(entity::registry ®istry)
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.
Abstract base class for updatable systems.
entity::registry & registry
Registry on which the system operate.
entt::registry registry
Component registry type.
entt::entity id
Entity ID type.
Half of a line proceeding from an initial point.
Collection of contact points between two colliding bodies.