Toast Engine
Toggle main menu visibility
Loading...
Searching...
No Matches
raycast.hpp
Go to the documentation of this file.
1
9
10
#pragma once
11
12
#include "
body.hpp
"
13
#include "
shape.hpp
"
14
#include "
toast/world/box.hpp
"
15
16
#include <glm/glm.hpp>
17
#include <optional>
18
#include <vector>
19
20
namespace
physics {
21
22
struct
RayHit
{
23
toast::Box<toast::Node>
node;
24
glm::vec3 position;
25
glm::vec3 normal;
26
float
distance;
27
BodyID
body;
28
ShapeID
shape;
29
};
30
36
TOAST_API
auto
raycast(
37
glm::vec3 origin, glm::vec3 direction,
float
max_distance = -1.0f,
BodyID
ignored = {},
const
std::vector<int>& layers = {}
38
) -> std::optional<RayHit>;
39
45
TOAST_API
auto
raymulticast(
46
glm::vec3 origin, glm::vec3 direction,
float
max_distance = -1.0f,
int
max_hits = -1,
BodyID
ignored = {},
47
const
std::vector<int>& layers = {}
48
) -> std::vector<RayHit>;
49
53
TOAST_API
auto
linecast(glm::vec3 from, glm::vec3 to,
int
max_hits = -1,
BodyID
ignored = {},
const
std::vector<int>& layers = {})
54
-> std::vector<RayHit>;
55
56
struct
SphereHit
{
57
toast::Box<toast::Node>
node;
58
glm::vec3 position;
59
glm::vec3 normal;
60
float
penetration;
61
};
62
63
TOAST_API
auto
sphereOverlap(glm::vec3 position,
float
radius) -> std::optional<SphereHit>;
64
66
TOAST_API
auto
overlapAABB(glm::vec3 min, glm::vec3 max) -> bool;
67
68
}
body.hpp
Body identifiers, creation data, and copied runtime state.
box.hpp
pseudo shared pointer for Nodes
toast::Box
Intrusive reference-counted handle to a Node.
Definition
box.hpp:35
shape.hpp
Shape identifiers, geometry, and runtime records.
physics::BodyID
Definition
body.hpp:20
physics::RayHit
Definition
raycast.hpp:22
physics::ShapeID
Definition
shape.hpp:29
physics::SphereHit
Definition
raycast.hpp:56
engine
src
toast
physics
raycast.hpp
Generated by
1.17.0