|
| | BoxCollider2D (float friction, float bounciness, float width=default_box_collider_width, float height=default_box_collider_height, Point offset={0.0f, 0.0f}, bool is_sensor=false, bool is_bullet=false) |
| |
| | ~BoxCollider2D () override=default |
| |
| void | update (float dt) override |
| |
| float | width () const noexcept |
| |
| BoxCollider2D & | width (float value) noexcept |
| |
| float | height () const noexcept |
| |
| BoxCollider2D & | height (float value) noexcept |
| |
| BoxCollider2D & | friction (float value) noexcept override |
| |
| BoxCollider2D & | bounciness (float value) noexcept override |
| |
| std::string | type_name () const override |
| | Provides a consistent type name for the component.
|
| |
| Point | offset () const noexcept override |
| |
| BoxCollider2D & | offset (Point value) noexcept override |
| |
| | 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 |
| |
| float | bounciness () const noexcept |
| |
| PhysicsCreationFlags & | creation_flags () noexcept |
| |
| Collider2D & | creation_flags (PhysicsCreationFlags 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 box collider component that defines a rectangular collision shape for a GameObject.
This component extends the Collider2D class to provide a box-shaped collider, enabling rectangular collision detection and response within the physics engine.
Usage:
- Create a BoxCollider2D component with desired properties.
- Attach the BoxCollider2D to a GameObject to enable rectangular collision detection.
- Modify properties such as width, height, friction, bounciness, offset, sensor status, and bullet status as needed.
- Note
- Ensure the GameObject has a Rigidbody2D component for proper physics