Unravel Engine C++ Reference
Loading...
Searching...
No Matches
bullet_backend.h
Go to the documentation of this file.
1#pragma once
2#include <engine/engine_export.h>
3
4#include <base/basetypes.hpp>
5#include <context/context.hpp>
6
10#include <graphics/debugdraw.h>
11#include <hpp/small_vector.hpp>
12
13namespace unravel
14{
15class camera;
16
17template<typename T, size_t SmallSizeCapacity = 8>
18using physics_vector = hpp::small_vector<T, SmallSizeCapacity>;
19
21{
22 void init();
23 void deinit();
26 void on_play_end(rtti::context& ctx);
27 void on_pause(rtti::context& ctx);
28 void on_resume(rtti::context& ctx);
30
32 float explosion_force,
33 const math::vec3& explosion_position,
34 float explosion_radius,
35 float upwards_modifier,
36 force_mode mode);
37 static void apply_force(physics_component& comp, const math::vec3& force, force_mode mode);
38 static void apply_torque(physics_component& comp, const math::vec3& toruqe, force_mode mode);
40
41 static auto ray_cast(const math::vec3& origin,
42 const math::vec3& direction,
43 float max_distance,
44 int layer_mask,
45 bool query_sensors) -> hpp::optional<raycast_hit>;
46
47 static auto ray_cast_all(const math::vec3& origin,
48 const math::vec3& direction,
49 float max_distance,
50 int layer_mask,
52
53 static auto sphere_cast(const math::vec3& origin,
54 const math::vec3& direction,
55 float radius,
56 float max_distance,
57 int layer_mask,
58 bool query_sensors) -> hpp::optional<raycast_hit>;
59
60 static auto sphere_cast_all(const math::vec3& origin,
61 const math::vec3& direction,
62 float radius,
63 float max_distance,
64 int layer_mask,
66
67 static auto sphere_overlap(const math::vec3& origin, float radius, int layer_mask, bool query_sensors)
69
70 static void on_create_component(entt::registry& r, entt::entity e);
71 static void on_destroy_component(entt::registry& r, entt::entity e);
72 static void on_destroy_bullet_rigidbody_component(entt::registry& r, entt::entity e);
73
74 static void on_create_cc_component(entt::registry& r, entt::entity e);
75 static void on_destroy_cc_component(entt::registry& r, entt::entity e);
76 static void on_destroy_bullet_cc_component(entt::registry& r, entt::entity e);
77
78 static void move_character(character_controller_component& comp, const math::vec3& displacement);
79 static void jump_character(character_controller_component& comp, const math::vec3& direction);
80 static void apply_impulse_character(character_controller_component& comp, const math::vec3& impulse);
81 static void warp_character(character_controller_component& comp, const math::vec3& position);
82 static void set_character_linear_velocity(character_controller_component& comp, const math::vec3& velocity);
84
85 static void on_create_active_component(entt::registry& r, entt::entity e);
86 static void on_destroy_active_component(entt::registry& r, entt::entity e);
87
88 static void draw_system_gizmos(rtti::context& ctx, const camera& cam, gfx::dd_raii& dd);
89 static void draw_gizmo(rtti::context& ctx, physics_component& comp, const camera& cam, gfx::dd_raii& dd);
90 static void draw_gizmo(rtti::context& ctx, character_controller_component& comp, const camera& cam, gfx::dd_raii& dd);
91};
92} // namespace unravel
bool query_sensors
Class representing a camera. Contains functionality for manipulating and updating a camera....
Definition camera.h:62
Component for character controller physics with sweep-based movement.
Component that handles physics properties and behaviors.
std::chrono::duration< float > delta_t
math::vec3 position
Definition defaults.cpp:52
hpp::small_vector< T, SmallSizeCapacity > physics_vector
void on_skip_next_frame(rtti::context &ctx)
static auto sphere_cast_all(const math::vec3 &origin, const math::vec3 &direction, float radius, float max_distance, int layer_mask, bool query_sensors) -> physics_vector< raycast_hit >
static void on_create_cc_component(entt::registry &r, entt::entity e)
static void on_create_component(entt::registry &r, entt::entity e)
static void set_character_linear_velocity(character_controller_component &comp, const math::vec3 &velocity)
static void warp_character(character_controller_component &comp, const math::vec3 &position)
static void on_create_active_component(entt::registry &r, entt::entity e)
static void draw_gizmo(rtti::context &ctx, physics_component &comp, const camera &cam, gfx::dd_raii &dd)
static auto ray_cast(const math::vec3 &origin, const math::vec3 &direction, float max_distance, int layer_mask, bool query_sensors) -> hpp::optional< raycast_hit >
void on_play_begin(rtti::context &ctx)
static void apply_force(physics_component &comp, const math::vec3 &force, force_mode mode)
static void sync_character_runtime_state(character_controller_component &comp)
static void on_destroy_active_component(entt::registry &r, entt::entity e)
void on_resume(rtti::context &ctx)
static void on_destroy_cc_component(entt::registry &r, entt::entity e)
void on_pause(rtti::context &ctx)
static void apply_impulse_character(character_controller_component &comp, const math::vec3 &impulse)
static void draw_system_gizmos(rtti::context &ctx, const camera &cam, gfx::dd_raii &dd)
static auto sphere_overlap(const math::vec3 &origin, float radius, int layer_mask, bool query_sensors) -> physics_vector< entt::entity >
static void move_character(character_controller_component &comp, const math::vec3 &displacement)
static void jump_character(character_controller_component &comp, const math::vec3 &direction)
static auto sphere_cast(const math::vec3 &origin, const math::vec3 &direction, float radius, float max_distance, int layer_mask, bool query_sensors) -> hpp::optional< raycast_hit >
static void apply_torque(physics_component &comp, const math::vec3 &toruqe, force_mode mode)
static void apply_explosion_force(physics_component &comp, float explosion_force, const math::vec3 &explosion_position, float explosion_radius, float upwards_modifier, force_mode mode)
static void on_destroy_component(entt::registry &r, entt::entity e)
static void clear_kinematic_velocities(physics_component &comp)
static void on_destroy_bullet_rigidbody_component(entt::registry &r, entt::entity e)
static void on_destroy_bullet_cc_component(entt::registry &r, entt::entity e)
void on_frame_update(rtti::context &ctx, delta_t dt)
static auto ray_cast_all(const math::vec3 &origin, const math::vec3 &direction, float max_distance, int layer_mask, bool query_sensors) -> physics_vector< raycast_hit >
void on_play_end(rtti::context &ctx)