Capycore Engine  0.1.0
A simple and lightweight game engine written in C++ based on the Unity API architecture.
Loading...
Searching...
No Matches
box_collider_2d.h
Go to the documentation of this file.
1#pragma once
2
5
6constexpr float default_box_collider_width = 1.0f;
7constexpr float default_box_collider_height = 1.0f;
8
25class BoxCollider2D : public Collider2D {
26 public:
30 Point offset = {0.0f, 0.0f}, bool is_sensor = false,
31 bool is_bullet = false);
32 ~BoxCollider2D() override = default;
33
34 void update(float dt) override;
35
36 [[nodiscard]] float width() const noexcept;
37 BoxCollider2D& width(float value) noexcept;
38
39 [[nodiscard]] float height() const noexcept;
40 BoxCollider2D& height(float value) noexcept;
41
42 BoxCollider2D& friction(float value) noexcept override;
43 BoxCollider2D& bounciness(float value) noexcept override;
44
45 std::string type_name() const override;
46
47 [[nodiscard]] Point offset() const noexcept override;
48 BoxCollider2D& offset(Point value) noexcept override;
49
50 private:
51 float width_;
52 float height_;
53};
constexpr float default_box_collider_height
Definition box_collider_2d.h:7
constexpr float default_box_collider_width
Definition box_collider_2d.h:6
A 2D box collider component that defines a rectangular collision shape for a GameObject.
Definition box_collider_2d.h:25
~BoxCollider2D() override=default
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)
std::string type_name() const override
Provides a consistent type name for the component.
float height() const noexcept
void update(float dt) override
float width() const noexcept
Point offset() const noexcept override
A 2D collider base that defines the shape and physical properties of a GameObject for collision detec...
Definition collider_2d.h:31
float friction() const noexcept
float bounciness() const noexcept
Represents a point in 2D space.
Definition point.h:6