2#include <engine/engine_export.h>
60 auto get_center()
const noexcept ->
const math::vec3&;
82 void move(
const math::vec3& displacement);
88 void jump(
float speed);
109 auto can_jump()
const noexcept -> bool;
111 auto get_velocity()
const noexcept ->
const math::vec3&;
113 auto is_dirty(uint8_t
id)
const noexcept -> bool;
114 void set_dirty(uint8_t
id,
bool dirty)
noexcept;
124 void on_change_shape();
128 math::vec3 center_{};
129 float step_height_{0.3f};
130 float slope_limit_{45.0f};
131 float skin_width_{0.08f};
132 float gravity_scale_{1.0f};
134 float terminal_velocity_{55.0f};
135 float linear_damping_{0.0f};
140 math::vec3 velocity_{};
141 bool grounded_{
false};
143 using underlying_t = std::underlying_type_t<character_controller_property>;
145 std::bitset<8> dirty_;
Component for character controller physics with sweep-based movement.
auto are_any_properties_dirty() const noexcept -> bool
auto get_skin_width() const noexcept -> float
void set_gravity_scale(float scale)
void warp(const math::vec3 &position)
void set_velocity_internal(const math::vec3 &vel) noexcept
auto get_height() const noexcept -> float
auto get_linear_velocity() const noexcept -> math::vec3
auto is_property_dirty(character_controller_property prop) const noexcept -> bool
void set_step_height(float step_height)
void set_dirty(uint8_t id, bool dirty) noexcept
void set_collision_exclude_mask(layer_mask mask)
void set_terminal_velocity(float speed)
auto get_slope_limit() const noexcept -> float
static void on_destroy_component(entt::registry &r, entt::entity e)
Called when the component is destroyed.
void set_skin_width(float skin_width)
auto get_velocity() const noexcept -> const math::vec3 &
auto get_terminal_velocity() const noexcept -> float
void set_collision_include_mask(layer_mask mask)
static void on_create_component(entt::registry &r, entt::entity e)
Called when the component is created.
void move(const math::vec3 &displacement)
auto get_gravity_scale() const noexcept -> float
auto get_linear_damping() const noexcept -> float
void set_radius(float radius)
auto is_dirty(uint8_t id) const noexcept -> bool
void set_linear_damping(float damping)
auto get_collision_exclude_mask() const -> layer_mask
auto get_radius() const noexcept -> float
auto can_jump() const noexcept -> bool
auto get_center() const noexcept -> const math::vec3 &
auto is_grounded() const noexcept -> bool
auto get_step_height() const noexcept -> float
auto get_collision_include_mask() const -> layer_mask
void set_grounded(bool grounded) noexcept
void jump(float speed)
Trigger a jump straight up with the given speed (m/s).
auto get_collision_mask() const -> layer_mask
void set_linear_velocity(const math::vec3 &velocity)
void set_slope_limit(float slope_limit_degrees)
void set_property_dirty(character_controller_property prop, bool dirty) noexcept
void set_center(const math::vec3 ¢er)
void apply_impulse(const math::vec3 &impulse)
void set_height(float height)
@ mask
Hard alpha cutoff; casts cutout shadows.
character_controller_property
Enum for trackable character controller properties.
std::vector< float > scale
CRTP (Curiously Recurring Template Pattern) base structure for components.