Unravel Engine C++ Reference
Loading...
Searching...
No Matches
unravel::character_controller_component Class Reference

Component for character controller physics with sweep-based movement. More...

#include <character_controller_component.h>

Inheritance diagram for unravel::character_controller_component:
unravel::component_crtp< character_controller_component, owned_component > unravel::owned_component unravel::basic_component

Public Member Functions

void set_radius (float radius)
 
auto get_radius () const noexcept -> float
 
void set_height (float height)
 
auto get_height () const noexcept -> float
 
void set_center (const math::vec3 &center)
 
auto get_center () const noexcept -> const math::vec3 &
 
void set_step_height (float step_height)
 
auto get_step_height () const noexcept -> float
 
void set_slope_limit (float slope_limit_degrees)
 
auto get_slope_limit () const noexcept -> float
 
void set_skin_width (float skin_width)
 
auto get_skin_width () const noexcept -> float
 
void set_gravity_scale (float scale)
 
auto get_gravity_scale () const noexcept -> float
 
void set_collision_include_mask (layer_mask mask)
 
auto get_collision_include_mask () const -> layer_mask
 
void set_collision_exclude_mask (layer_mask mask)
 
auto get_collision_exclude_mask () const -> layer_mask
 
auto get_collision_mask () const -> layer_mask
 
void move (const math::vec3 &displacement)
 
void jump (float speed)
 Trigger a jump straight up with the given speed (m/s).
 
void jump (const math::vec3 &velocity)
 Trigger a directional jump. The velocity's magnitude is the jump speed and its direction is the jump axis.
 
void apply_impulse (const math::vec3 &impulse)
 
void warp (const math::vec3 &position)
 
void set_terminal_velocity (float speed)
 
auto get_terminal_velocity () const noexcept -> float
 
void set_linear_velocity (const math::vec3 &velocity)
 
auto get_linear_velocity () const noexcept -> math::vec3
 
void set_linear_damping (float damping)
 
auto get_linear_damping () const noexcept -> float
 
auto can_jump () const noexcept -> bool
 
auto is_grounded () const noexcept -> bool
 
auto get_velocity () const noexcept -> const math::vec3 &
 
auto is_dirty (uint8_t id) const noexcept -> bool
 
void set_dirty (uint8_t id, bool dirty) noexcept
 
auto is_property_dirty (character_controller_property prop) const noexcept -> bool
 
auto are_any_properties_dirty () const noexcept -> bool
 
void set_property_dirty (character_controller_property prop, bool dirty) noexcept
 
void set_grounded (bool grounded) noexcept
 
void set_velocity_internal (const math::vec3 &vel) noexcept
 
- Public Member Functions inherited from unravel::owned_component
auto operator= (const owned_component &other) -> owned_component &=default
 
void set_owner (entt::handle owner)
 Sets the owner of the component.
 
auto get_owner () const noexcept -> entt::const_handle
 Gets the owner of the component.
 
auto get_owner () noexcept -> entt::handle
 Gets the owner of the component.
 
- Public Member Functions inherited from unravel::basic_component
void touch ()
 Marks the component as 'touched'.
 

Static Public Member Functions

static void on_create_component (entt::registry &r, entt::entity e)
 Called when the component is created.
 
static void on_destroy_component (entt::registry &r, entt::entity e)
 Called when the component is destroyed.
 
- Static Public Member Functions inherited from unravel::owned_component
template<typename T >
static void on_create_component (entt::registry &r, entt::entity e)
 
template<typename T >
static void on_destroy_component (entt::registry &r, entt::entity e)
 

Additional Inherited Members

- Public Types inherited from unravel::component_crtp< character_controller_component, owned_component >
using base
 
- Public Attributes inherited from unravel::basic_component
bool eto {}
 Disable empty type optimizations.
 
- Static Public Attributes inherited from unravel::component_crtp< character_controller_component, owned_component >
static constexpr bool in_place_delete
 Indicates if the component can be deleted in place.
 

Detailed Description

Component for character controller physics with sweep-based movement.

Uses a capsule shape internally. Movement is performed via move(displacement) rather than forces/impulses. Mutually exclusive with physics_component.

Definition at line 36 of file character_controller_component.h.

Member Function Documentation

◆ apply_impulse()

void unravel::character_controller_component::apply_impulse ( const math::vec3 & impulse)

Definition at line 173 of file character_controller_component.cpp.

◆ are_any_properties_dirty()

auto unravel::character_controller_component::are_any_properties_dirty ( ) const -> bool
noexcept

Definition at line 269 of file character_controller_component.cpp.

◆ can_jump()

auto unravel::character_controller_component::can_jump ( ) const -> bool
noexcept

Definition at line 225 of file character_controller_component.cpp.

◆ get_center()

auto unravel::character_controller_component::get_center ( ) const -> const math::vec3&
noexcept

Definition at line 60 of file character_controller_component.cpp.

◆ get_collision_exclude_mask()

auto unravel::character_controller_component::get_collision_exclude_mask ( ) const -> layer_mask

Definition at line 148 of file character_controller_component.cpp.

◆ get_collision_include_mask()

auto unravel::character_controller_component::get_collision_include_mask ( ) const -> layer_mask

Definition at line 136 of file character_controller_component.cpp.

◆ get_collision_mask()

auto unravel::character_controller_component::get_collision_mask ( ) const -> layer_mask

Definition at line 153 of file character_controller_component.cpp.

◆ get_gravity_scale()

auto unravel::character_controller_component::get_gravity_scale ( ) const -> float
noexcept

Definition at line 124 of file character_controller_component.cpp.

◆ get_height()

auto unravel::character_controller_component::get_height ( ) const -> float
noexcept

Definition at line 45 of file character_controller_component.cpp.

◆ get_linear_damping()

auto unravel::character_controller_component::get_linear_damping ( ) const -> float
noexcept

Definition at line 220 of file character_controller_component.cpp.

◆ get_linear_velocity()

auto unravel::character_controller_component::get_linear_velocity ( ) const -> math::vec3
noexcept

Definition at line 204 of file character_controller_component.cpp.

◆ get_radius()

auto unravel::character_controller_component::get_radius ( ) const -> float
noexcept

Definition at line 30 of file character_controller_component.cpp.

◆ get_skin_width()

auto unravel::character_controller_component::get_skin_width ( ) const -> float
noexcept

Definition at line 108 of file character_controller_component.cpp.

◆ get_slope_limit()

auto unravel::character_controller_component::get_slope_limit ( ) const -> float
noexcept

Definition at line 92 of file character_controller_component.cpp.

◆ get_step_height()

auto unravel::character_controller_component::get_step_height ( ) const -> float
noexcept

Definition at line 76 of file character_controller_component.cpp.

◆ get_terminal_velocity()

auto unravel::character_controller_component::get_terminal_velocity ( ) const -> float
noexcept

Definition at line 194 of file character_controller_component.cpp.

◆ get_velocity()

auto unravel::character_controller_component::get_velocity ( ) const -> const math::vec3&
noexcept

Definition at line 235 of file character_controller_component.cpp.

◆ is_dirty()

auto unravel::character_controller_component::is_dirty ( uint8_t id) const -> bool
noexcept

Definition at line 250 of file character_controller_component.cpp.

◆ is_grounded()

auto unravel::character_controller_component::is_grounded ( ) const -> bool
noexcept

Definition at line 230 of file character_controller_component.cpp.

◆ is_property_dirty()

auto unravel::character_controller_component::is_property_dirty ( character_controller_property prop) const -> bool
noexcept

Definition at line 264 of file character_controller_component.cpp.

◆ jump() [1/2]

void unravel::character_controller_component::jump ( const math::vec3 & velocity)

Trigger a directional jump. The velocity's magnitude is the jump speed and its direction is the jump axis.

Parameters
velocityWorld-space jump velocity; must be non-zero.

Definition at line 168 of file character_controller_component.cpp.

◆ jump() [2/2]

void unravel::character_controller_component::jump ( float speed)

Trigger a jump straight up with the given speed (m/s).

Parameters
speedInitial upward speed; must be > 0.

Definition at line 163 of file character_controller_component.cpp.

◆ move()

void unravel::character_controller_component::move ( const math::vec3 & displacement)

Definition at line 158 of file character_controller_component.cpp.

◆ on_create_component()

void unravel::character_controller_component::on_create_component ( entt::registry & r,
entt::entity e )
static

Called when the component is created.

Parameters
rThe registry containing the component.
eThe entity associated with the component.

Definition at line 7 of file character_controller_component.cpp.

◆ on_destroy_component()

void unravel::character_controller_component::on_destroy_component ( entt::registry & r,
entt::entity e )
static

Called when the component is destroyed.

Parameters
rThe registry containing the component.
eThe entity associated with the component.

Definition at line 16 of file character_controller_component.cpp.

◆ set_center()

void unravel::character_controller_component::set_center ( const math::vec3 & center)

Definition at line 50 of file character_controller_component.cpp.

◆ set_collision_exclude_mask()

void unravel::character_controller_component::set_collision_exclude_mask ( layer_mask mask)

Definition at line 141 of file character_controller_component.cpp.

◆ set_collision_include_mask()

void unravel::character_controller_component::set_collision_include_mask ( layer_mask mask)

Definition at line 129 of file character_controller_component.cpp.

◆ set_dirty()

void unravel::character_controller_component::set_dirty ( uint8_t id,
bool dirty )
noexcept

Definition at line 255 of file character_controller_component.cpp.

◆ set_gravity_scale()

void unravel::character_controller_component::set_gravity_scale ( float scale)

Definition at line 113 of file character_controller_component.cpp.

◆ set_grounded()

void unravel::character_controller_component::set_grounded ( bool grounded)
noexcept

Definition at line 240 of file character_controller_component.cpp.

◆ set_height()

void unravel::character_controller_component::set_height ( float height)

Definition at line 35 of file character_controller_component.cpp.

◆ set_linear_damping()

void unravel::character_controller_component::set_linear_damping ( float damping)

Definition at line 209 of file character_controller_component.cpp.

◆ set_linear_velocity()

void unravel::character_controller_component::set_linear_velocity ( const math::vec3 & velocity)

Definition at line 199 of file character_controller_component.cpp.

◆ set_property_dirty()

void unravel::character_controller_component::set_property_dirty ( character_controller_property prop,
bool dirty )
noexcept

Definition at line 274 of file character_controller_component.cpp.

◆ set_radius()

void unravel::character_controller_component::set_radius ( float radius)

Definition at line 20 of file character_controller_component.cpp.

◆ set_skin_width()

void unravel::character_controller_component::set_skin_width ( float skin_width)

Definition at line 97 of file character_controller_component.cpp.

◆ set_slope_limit()

void unravel::character_controller_component::set_slope_limit ( float slope_limit_degrees)

Definition at line 81 of file character_controller_component.cpp.

◆ set_step_height()

void unravel::character_controller_component::set_step_height ( float step_height)

Definition at line 65 of file character_controller_component.cpp.

◆ set_terminal_velocity()

void unravel::character_controller_component::set_terminal_velocity ( float speed)

Definition at line 183 of file character_controller_component.cpp.

◆ set_velocity_internal()

void unravel::character_controller_component::set_velocity_internal ( const math::vec3 & vel)
noexcept

Definition at line 245 of file character_controller_component.cpp.

◆ warp()

void unravel::character_controller_component::warp ( const math::vec3 & position)

Definition at line 178 of file character_controller_component.cpp.


The documentation for this class was generated from the following files: