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

Manages the physics operations using the specified backend. More...

#include <physics_system.h>

Public Types

using backend_type = bullet_backend
 The backend type used for physics operations.
 

Public Member Functions

auto init (rtti::context &ctx) -> bool
 Initializes the physics system with the given context.
 
auto deinit (rtti::context &ctx) -> bool
 Deinitializes the physics system with the given context.
 
auto ray_cast (const math::vec3 &origin, const math::vec3 &direction, float max_distance, int layer_mask, bool query_sensors) const -> hpp::optional< raycast_hit >
 
auto ray_cast_all (const math::vec3 &origin, const math::vec3 &direction, float max_distance, int layer_mask, bool query_sensors) const -> physics_vector< raycast_hit >
 
auto sphere_cast (const math::vec3 &origin, const math::vec3 &direction, float radius, float max_distance, int layer_mask, bool query_sensors) const -> hpp::optional< raycast_hit >
 
auto sphere_cast_all (const math::vec3 &origin, const math::vec3 &direction, float radius, float max_distance, int layer_mask, bool query_sensors) const -> physics_vector< raycast_hit >
 
auto sphere_overlap (const math::vec3 &origin, float radius, int layer_mask, bool query_sensors) const -> physics_vector< entt::entity >
 

Static Public Member Functions

static void on_create_component (entt::registry &r, entt::entity e)
 Called when a physics component is created.
 
static void on_destroy_component (entt::registry &r, entt::entity e)
 Called when a physics component is destroyed.
 
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 apply_force (physics_component &comp, const math::vec3 &force, force_mode mode)
 
static void apply_torque (physics_component &comp, const math::vec3 &torque, force_mode mode)
 Applies a torque to the specified physics component.
 
static void clear_kinematic_velocities (physics_component &comp)
 Clears kinematic velocities for the specified physics component.
 

Detailed Description

Manages the physics operations using the specified backend.

Definition at line 14 of file physics_system.h.

Member Typedef Documentation

◆ backend_type

The backend type used for physics operations.

Definition at line 17 of file physics_system.h.

Member Function Documentation

◆ apply_explosion_force()

void unravel::physics_system::apply_explosion_force ( physics_component & comp,
float explosion_force,
const math::vec3 & explosion_position,
float explosion_radius,
float upwards_modifier,
force_mode mode )
static

Definition at line 104 of file physics_system.cpp.

◆ apply_force()

void unravel::physics_system::apply_force ( physics_component & comp,
const math::vec3 & force,
force_mode mode )
static

Definition at line 119 of file physics_system.cpp.

◆ apply_torque()

void unravel::physics_system::apply_torque ( physics_component & comp,
const math::vec3 & torque,
force_mode mode )
static

Applies a torque to the specified physics component.

Parameters
compThe physics component.
torqueThe torque vector.

Definition at line 124 of file physics_system.cpp.

◆ clear_kinematic_velocities()

void unravel::physics_system::clear_kinematic_velocities ( physics_component & comp)
static

Clears kinematic velocities for the specified physics component.

Parameters
compThe physics component.

Definition at line 129 of file physics_system.cpp.

◆ deinit()

auto unravel::physics_system::deinit ( rtti::context & ctx) -> bool

Deinitializes the physics system with the given context.

Parameters
ctxThe context to deinitialize.
Returns
True if deinitialization was successful, false otherwise.

Definition at line 44 of file physics_system.cpp.

◆ init()

auto unravel::physics_system::init ( rtti::context & ctx) -> bool

Initializes the physics system with the given context.

Parameters
ctxThe context to initialize with.
Returns
True if initialization was successful, false otherwise.

Definition at line 26 of file physics_system.cpp.

◆ on_create_component()

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

Called when a physics component is created.

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

Definition at line 15 of file physics_system.cpp.

◆ on_destroy_component()

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

Called when a physics component is destroyed.

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

Definition at line 20 of file physics_system.cpp.

◆ ray_cast()

auto unravel::physics_system::ray_cast ( const math::vec3 & origin,
const math::vec3 & direction,
float max_distance,
int layer_mask,
bool query_sensors ) const -> hpp::optional<raycast_hit>

Definition at line 134 of file physics_system.cpp.

◆ ray_cast_all()

auto unravel::physics_system::ray_cast_all ( const math::vec3 & origin,
const math::vec3 & direction,
float max_distance,
int layer_mask,
bool query_sensors ) const -> physics_vector<raycast_hit>

Definition at line 143 of file physics_system.cpp.

◆ sphere_cast()

auto unravel::physics_system::sphere_cast ( const math::vec3 & origin,
const math::vec3 & direction,
float radius,
float max_distance,
int layer_mask,
bool query_sensors ) const -> hpp::optional<raycast_hit>

Definition at line 152 of file physics_system.cpp.

◆ sphere_cast_all()

auto unravel::physics_system::sphere_cast_all ( const math::vec3 & origin,
const math::vec3 & direction,
float radius,
float max_distance,
int layer_mask,
bool query_sensors ) const -> physics_vector<raycast_hit>

Definition at line 162 of file physics_system.cpp.

◆ sphere_overlap()

auto unravel::physics_system::sphere_overlap ( const math::vec3 & origin,
float radius,
int layer_mask,
bool query_sensors ) const -> physics_vector<entt::entity>

Definition at line 172 of file physics_system.cpp.


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