|
| | Collider2D (float friction=default_friction_2d, float bounciness=default_bounciness_2d, Point offset={0.0f, 0.0f}) |
| |
| | ~Collider2D () override=default |
| |
| void | update (float dt) override |
| |
| void | on_trigger_enter (Collider2D &other) |
| | Called when another collider enters this collider's trigger area.
|
| |
| size_t | add_on_trigger_enter (const std::function< void(Collider2D &, Collider2D &)> &action) |
| |
| void | remove_on_trigger_enter (int index) |
| |
| void | on_trigger_exit (Collider2D &other) |
| | Called when another collider exits this collider's trigger area.
|
| |
| size_t | add_on_trigger_exit (const std::function< void(Collider2D &, Collider2D &)> &action) |
| |
| void | remove_on_trigger_exit (int index) |
| |
| void | on_collision_enter (Collider2D &other) |
| | Called when another collider exits this collider's trigger area.
|
| |
| size_t | add_on_collision_enter (const std::function< void(Collider2D &, Collider2D &)> &action) |
| |
| void | remove_on_collision_enter (int index) |
| |
| void | on_collision_exit (Collider2D &other) |
| | Called when another collider exits this collider's trigger area.
|
| |
| size_t | add_on_collision_exit (const std::function< void(Collider2D &, Collider2D &)> &action) |
| |
| void | remove_on_collision_exit (int index) |
| |
| BodyDistance2D | distance (Collider2D &other, bool use_fixture=false) |
| | Calculate the distance to another collider.
|
| |
| ColliderRayResult | raycast (const Point &direction, float max_distance) |
| | Perform a raycast from this collider in a specified direction.
|
| |
| std::reference_wrapper< Rigidbody2D > | get_rigidbody () |
| |
| float | friction () const noexcept |
| |
| virtual Collider2D & | friction (float value) noexcept |
| |
| float | bounciness () const noexcept |
| |
| virtual Collider2D & | bounciness (float value) noexcept |
| |
| PhysicsCreationFlags & | creation_flags () noexcept |
| |
| Collider2D & | creation_flags (PhysicsCreationFlags value) noexcept |
| |
| virtual Point | offset () const noexcept |
| |
| virtual Collider2D & | offset (Point value) noexcept |
| |
| std::string | type_name () const override |
| | Provides a consistent type name for the component.
|
| |
| | Renderable () |
| |
| | Renderable (int layer) |
| |
| | ~Renderable () override=default |
| |
| Renderable & | order_in_layer (int layer) |
| |
| int | order_in_layer () const |
| |
| void | set_render_strategy (Component &component) |
| |
| virtual IRenderingStrategy & | render_strategy () const |
| |
| std::string | type_name () const override |
| | Provides a consistent type name for the component.
|
| |
| Renderable & | disable_draw () noexcept |
| |
| Renderable & | enable_draw () noexcept |
| |
| bool | should_draw () const noexcept |
| |
| | Component () |
| |
| virtual | ~Component ()=default |
| |
| bool | active () const noexcept |
| | Checks if the component is active.
|
| |
| Component & | active (bool value) noexcept |
| |
| bool | marked_for_deletion () const noexcept |
| | Activates the component.
|
| |
| Component & | mark_for_deletion () noexcept |
| |
| virtual void | on_attach () |
| | Called when the component is attached to a GameObject.
|
| |
| virtual void | on_detach () |
| | Called when the component is detached from a GameObject.
|
| |
| virtual void | on_serialize (std::vector< uint8_t > &) const |
| | Serializes the component's state into a byte array.
|
| |
| virtual void | on_deserialize (const std::vector< uint8_t > &, size_t &) |
| | Deserializes the component's state from a byte array.
|
| |
| const std::optional< std::reference_wrapper< GameObject > > & | parent () const noexcept |
| | Gets the parent GameObject of this component.
|
| |
| std::optional< std::reference_wrapper< GameObject > > & | parent () noexcept |
| | Gets the parent GameObject of this component.
|
| |
| Component & | parent (GameObject &parent) |
| |
| Component & | parent (std::nullopt_t nullopt) |
| |
| size_t | add_on_attach (const std::function< void(Component &)> &action) |
| | Retrieves the type information of the component.
|
| |
| void | remove_on_attach (size_t index) |
| |
| size_t | add_on_detach (const std::function< void(Component &)> &action) |
| | Adds an action to be performed when the component is attached.
|
| |
| void | remove_on_detach (size_t index) |
| |
A 2D collider base that defines the shape and physical properties of a GameObject for collision detection.
- Note
- This is an abstract base class and should be inherited by specific collider shapes like CircleCollider2D, BoxCollider2D, etc.
This component allows a GameObject to participate in collision detection and response within the physics engine. It provides methods for handling collision events and querying collision information.
- Note
- Users should derive from this class to implement specific collider shapes.