sandbox
Loading...
Searching...
No Matches
character_controller.hpp
1// SPDX-License-Identifier: MIT
2#ifndef LIBSBX_PHYSICS_CHARACTER_CONTROLLER_HPP_
3#define LIBSBX_PHYSICS_CHARACTER_CONTROLLER_HPP_
4
5#include <libsbx/utility/enum.hpp>
6
7#include <libsbx/math/vector3.hpp>
8#include <libsbx/math/quaternion.hpp>
9
10#include <libsbx/physics/shape_collider.hpp>
11#include <libsbx/physics/mesh_collider.hpp>
12#include <libsbx/physics/collision_detection.hpp>
13
14namespace sbx::physics {
15
16enum class collision_flags : std::uint8_t {
17 none = 0,
18 below = utility::bit_v<0>,
19 above = utility::bit_v<1>,
20 sides = utility::bit_v<2>
21}; // enum class collision_flags
22
24 math::vector3 position;
25 collision_flags flags{collision_flags::none};
26 math::vector3 ground_normal{0.0f, 1.0f, 0.0f};
27 bool grounded{false};
28}; // struct move_result
29
31 std::float_t height{2.0f};
32 std::float_t radius{0.5f};
33 std::float_t slope_limit{45.0f};
34 std::float_t step_offset{0.3f};
35 std::float_t skin_width{0.01f};
36 std::float_t ground_snap_distance{0.2f};
37
38 math::vector3 displacement{math::vector3::zero};
39
40 collision_flags flags{collision_flags::none};
41 math::vector3 ground_normal{math::vector3::up};
42 bool is_grounded{false};
43
44 bool was_grounded{false};
45}; // struct character_controller
46
47} // namespace sbx::physics
48
49template<>
50struct sbx::utility::is_bit_field<sbx::physics::collision_flags> : std::true_type { };
51
52#endif // LIBSBX_PHYSICS_CHARACTER_CONTROLLER_HPP_
Definition: vector3.hpp:23
Definition: character_controller.hpp:30
Definition: character_controller.hpp:23
Definition: enum.hpp:29