126 on_trigger_enter_actions_;
128 on_trigger_exit_actions_;
130 on_collision_enter_actions_;
132 on_collision_exit_actions_;
A 2D collider base that defines the shape and physical properties of a GameObject for collision detec...
Definition collider_2d.h:31
std::reference_wrapper< Rigidbody2D > get_rigidbody()
void remove_on_trigger_enter(int index)
size_t add_on_collision_enter(const std::function< void(Collider2D &, Collider2D &)> &action)
void remove_on_trigger_exit(int index)
float friction() const noexcept
PhysicsCreationFlags & creation_flags() noexcept
BodyDistance2D distance(Collider2D &other, bool use_fixture=false)
Calculate the distance to another collider.
float friction_
Definition collider_2d.h:120
void remove_on_collision_exit(int index)
virtual Point offset() const noexcept
void on_collision_enter(Collider2D &other)
Called when another collider exits this collider's trigger area.
std::string type_name() const override
Provides a consistent type name for the component.
size_t add_on_trigger_exit(const std::function< void(Collider2D &, Collider2D &)> &action)
void update(float dt) override
size_t add_on_collision_exit(const std::function< void(Collider2D &, Collider2D &)> &action)
size_t add_on_trigger_enter(const std::function< void(Collider2D &, Collider2D &)> &action)
float bounciness() const noexcept
ColliderRayResult raycast(const Point &direction, float max_distance)
Perform a raycast from this collider in a specified direction.
void on_trigger_enter(Collider2D &other)
Called when another collider enters this collider's trigger area.
PhysicsCreationFlags creation_flags_
Definition collider_2d.h:119
Point offset_
Definition collider_2d.h:122
void on_collision_exit(Collider2D &other)
Called when another collider exits this collider's trigger area.
float bounciness_
Definition collider_2d.h:121
Collider2D(float friction=default_friction_2d, float bounciness=default_bounciness_2d, Point offset={0.0f, 0.0f})
~Collider2D() override=default
void on_trigger_exit(Collider2D &other)
Called when another collider exits this collider's trigger area.
void remove_on_collision_enter(int index)
Represents a point in 2D space.
Definition point.h:6
Base class for renderable components in the engine.
Definition renderable.h:16
constexpr float default_friction_2d
Definition collider_2d.h:15
constexpr float default_bounciness_2d
Definition collider_2d.h:16
Structure representing the distance information between two colliders.
Definition body_distance_2d.h:11
Structure representing the result of a raycast in the physics world.
Definition collider_ray_result.h:13
Flags for creating physics bodies.
Definition physics_creation_flags.h:14