12 component.dirty_.set();
13 component.dirty_properties_.set();
22 if(math::epsilonEqual(radius_, radius, math::epsilon<float>()))
37 if(math::epsilonEqual(height_,
height, math::epsilon<float>()))
67 if(math::epsilonEqual(step_height_,
step_height, math::epsilon<float>()))
83 if(math::epsilonEqual(slope_limit_, slope_limit_degrees, math::epsilon<float>()))
87 slope_limit_ = slope_limit_degrees;
99 if(math::epsilonEqual(skin_width_,
skin_width, math::epsilon<float>()))
115 if(math::epsilonEqual(gravity_scale_,
scale, math::epsilon<float>()))
119 gravity_scale_ =
scale;
126 return gravity_scale_;
133 collision_include_mask_ =
mask;
138 return collision_include_mask_;
145 collision_exclude_mask_ =
mask;
150 return collision_exclude_mask_;
155 return layer_mask{collision_include_mask_.
mask & ~collision_exclude_mask_.mask};
185 if(math::epsilonEqual(terminal_velocity_, speed, math::epsilon<float>()))
189 terminal_velocity_ = speed;
196 return terminal_velocity_;
211 if(math::epsilonEqual(linear_damping_, damping, math::epsilon<float>()))
215 linear_damping_ = damping;
222 return linear_damping_;
242 grounded_ = grounded;
257 dirty_.set(
id, dirty);
260 dirty_properties_ = {};
266 return dirty_properties_[
static_cast<underlying_t
>(prop)];
271 return dirty_properties_.any();
276 dirty_properties_[
static_cast<underlying_t
>(prop)] = dirty;
279void character_controller_component::on_change_shape()
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)
void set_owner(entt::handle owner)
Sets the owner of the component.
static void jump_character(character_controller_component &comp, const math::vec3 &direction)
static void warp_character(character_controller_component &comp, const math::vec3 &position)
static void apply_impulse_character(character_controller_component &comp, const math::vec3 &impulse)
static void move_character(character_controller_component &comp, const math::vec3 &displacement)
Moves a character controller by a displacement.
static void set_character_linear_velocity(character_controller_component &comp, const math::vec3 &velocity)
@ mask
Hard alpha cutoff; casts cutout shadows.
character_controller_property
Enum for trackable character controller properties.
std::vector< float > scale