38 [[nodiscard]]
float mass() const noexcept;
78 size_t& offset) override;
89 bool fresh_spawned_{
true};
Base class for all components that can be attached to GameObjects.
Definition component.h:24
A 2D rigidbody component that adds physics properties to a GameObject.
Definition rigidbody_2d.h:23
void on_deserialize(const std::vector< uint8_t > &data, size_t &offset) override
Deserializes the component's state from a byte array.
float mass() const noexcept
void on_serialize(std::vector< uint8_t > &out) const override
Serializes the component's state into a byte array.
void update(float dt) override
bool use_gravity() const noexcept
Rigidbody2D(BodyType2D::Type type=BodyType2D::Dynamic, float mass=default_rigidbody_mass, bool use_gravity=default_rigidbody_use_gravity, float gravity_scale=default_rigidbody_gravity_scale)
void mark_network_dirty() noexcept
Vector3 velocity() const noexcept
Retrieves the current velocity of the rigidbody.
std::string type_name() const override
Provides a consistent type name for the component.
Rigidbody2D & teleport(const Vector3 &position) noexcept
BodyType2D::Type type() const noexcept
void apply_impulse(const Vector3 &impulse) noexcept
Applies an impulse to the rigidbody.
float gravity_scale() const noexcept
void apply_force(const Vector3 &force) noexcept
Applies a force to the rigidbody.
Body2D body() const noexcept
Represents a 3D vector with x, y, and z components. This class provides basic vector operations such ...
Definition vector3.h:8
constexpr bool default_rigidbody_use_gravity
Definition rigidbody_2d.h:7
constexpr float default_rigidbody_gravity_scale
Definition rigidbody_2d.h:8
constexpr float default_rigidbody_mass
Definition rigidbody_2d.h:6
Structure representing a 2D physics body.
Definition body_2d.h:26
Enumeration of 2D body types.
Definition body_type_2d.h:13
Type
Definition body_type_2d.h:14
@ Dynamic
Definition body_type_2d.h:14