30 APPLOG_TRACE(
"{}::{}", hpp::type_name_str(*
this), __func__);
32 auto& ev = ctx.get_cached<
events>();
33 ev.
on_frame_update.connect(sentinel_,
this, &physics_system::on_frame_update);
35 ev.on_play_begin.connect(sentinel_, 10,
this, &physics_system::on_play_begin);
36 ev.on_play_end.connect(sentinel_, -10,
this, &physics_system::on_play_end);
37 ev.on_pause.connect(sentinel_, 10,
this, &physics_system::on_pause);
38 ev.on_resume.connect(sentinel_, -10,
this, &physics_system::on_resume);
39 ev.on_skip_next_frame.connect(sentinel_, -10,
this, &physics_system::on_skip_next_frame);
48 APPLOG_TRACE(
"{}::{}", hpp::type_name_str(*
this), __func__);
57 APPLOG_TRACE(
"{}::{}", hpp::type_name_str(*
this), __func__);
61 auto& registry = *scn.registry;
69 APPLOG_TRACE(
"{}::{}", hpp::type_name_str(*
this), __func__);
75 auto& registry = *scn.registry;
77 registry.ctx().erase<physics_system*>();
101 if(play.is_simulation_running() && !play.is_paused())
105 if(play.frames_running() == 0)
113 float explosion_force,
114 const math::vec3& explosion_position,
115 float explosion_radius,
116 float upwards_modifier,
180 const math::vec3& direction,
189 const math::vec3& direction,
198 const math::vec3& direction,
208 const math::vec3& direction,
Component for character controller physics with sweep-based movement.
static void on_destroy_component(entt::registry &r, entt::entity e)
Called when the component is destroyed.
static void on_create_component(entt::registry &r, entt::entity e)
Called when the component is created.
Component that handles physics properties and behaviors.
static void on_destroy_component(entt::registry &r, entt::entity e)
Called when the component is destroyed.
static void on_create_component(entt::registry &r, entt::entity e)
Called when the component is created.
Manages the physics operations using the specified backend.
auto ray_cast(const math::vec3 &origin, const math::vec3 &direction, float max_distance, int layer_mask, bool query_sensors) const -> hpp::optional< raycast_hit >
static void on_destroy_component(entt::registry &r, entt::entity e)
Called when a physics component is destroyed.
static void apply_force(physics_component &comp, const math::vec3 &force, force_mode mode)
static void apply_torque(physics_component &comp, const math::vec3 &torque, force_mode mode)
Applies a torque to the specified physics component.
auto sphere_cast_all(const math::vec3 &origin, const math::vec3 &direction, float radius, float max_distance, int layer_mask, bool query_sensors) const -> physics_vector< raycast_hit >
static void clear_kinematic_velocities(physics_component &comp)
Clears kinematic velocities for the specified physics component.
auto deinit(rtti::context &ctx) -> bool
Deinitializes the physics system with the given context.
static void jump_character(character_controller_component &comp, const math::vec3 &direction)
static void warp_character(character_controller_component &comp, const math::vec3 &position)
auto sphere_overlap(const math::vec3 &origin, float radius, int layer_mask, bool query_sensors) const -> physics_vector< entt::entity >
auto ray_cast_all(const math::vec3 &origin, const math::vec3 &direction, float max_distance, int layer_mask, bool query_sensors) const -> physics_vector< raycast_hit >
static void apply_impulse_character(character_controller_component &comp, const math::vec3 &impulse)
static void move_character(character_controller_component &comp, const math::vec3 &displacement)
Moves a character controller by a displacement.
auto init(rtti::context &ctx) -> bool
Initializes the physics system with the given context.
static void on_create_component(entt::registry &r, entt::entity e)
Called when a physics component is created.
static void set_character_linear_velocity(character_controller_component &comp, const math::vec3 &velocity)
static void on_create_cc_component(entt::registry &r, entt::entity e)
auto sphere_cast(const math::vec3 &origin, const math::vec3 &direction, float radius, float max_distance, int layer_mask, bool query_sensors) const -> hpp::optional< raycast_hit >
static void on_destroy_cc_component(entt::registry &r, entt::entity e)
static void apply_explosion_force(physics_component &comp, float explosion_force, const math::vec3 &explosion_position, float explosion_radius, float upwards_modifier, force_mode mode)
std::chrono::duration< float > delta_t
#define APPLOG_TRACE(...)
hpp::small_vector< T, SmallSizeCapacity > physics_vector
#define APP_SCOPE_PERF(name_literal)
Create a scoped performance timer that records to the timeline profiler. Only accepts string literals...
void on_skip_next_frame(rtti::context &ctx)
static void on_create_cc_component(entt::registry &r, entt::entity e)
static void on_create_component(entt::registry &r, entt::entity e)
static void set_character_linear_velocity(character_controller_component &comp, const math::vec3 &velocity)
static void warp_character(character_controller_component &comp, const math::vec3 &position)
void on_play_begin(rtti::context &ctx)
static void apply_force(physics_component &comp, const math::vec3 &force, force_mode mode)
void on_resume(rtti::context &ctx)
static void on_destroy_cc_component(entt::registry &r, entt::entity e)
void on_pause(rtti::context &ctx)
static void apply_impulse_character(character_controller_component &comp, const math::vec3 &impulse)
static void move_character(character_controller_component &comp, const math::vec3 &displacement)
static void jump_character(character_controller_component &comp, const math::vec3 &direction)
static void apply_torque(physics_component &comp, const math::vec3 &toruqe, force_mode mode)
static void apply_explosion_force(physics_component &comp, float explosion_force, const math::vec3 &explosion_position, float explosion_radius, float upwards_modifier, force_mode mode)
static void on_destroy_component(entt::registry &r, entt::entity e)
static void clear_kinematic_velocities(physics_component &comp)
void on_frame_update(rtti::context &ctx, delta_t dt)
void on_play_end(rtti::context &ctx)
Manages the entity-component-system (ECS) operations for the ACE framework.
auto get_scene() -> scene &
Gets the current scene.
hpp::event< void(rtti::context &, delta_t)> on_frame_update