Nebula
Loading...
Searching...
No Matches
scenequery.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
12//------------------------------------------------------------------------------
13#include "core/types.h"
14#include "physicsinterface.h"
15
16namespace Physics
17{
18
19//------------------------------------------------------------------------------
23{
24 uint32_t group = 0;
25 uint32_t mask = 0xFFFFFFFF;
27};
28
29//------------------------------------------------------------------------------
38{
39 uint64_t entity; // game entity id
40 uint32_t shapeId;
41 float distance;
44 uint32_t faceIndex;
45};
46
47//------------------------------------------------------------------------------
65{
66 uint64_t entity; // game entity id
67 uint32_t shapeId;
68 float distance;
71 uint32_t faceIndex;
72};
73
74//------------------------------------------------------------------------------
84{
85 Physics::ColliderType type = Physics::ColliderType_Sphere;
88 Math::vec3 boxExtents = Math::vec3(0.5f, 0.5f, 0.5f); // half extents
89 float sphereRadius = 0.5f;
90};
91
93bool Raycast(IndexT scene, const Math::point& origin, const Math::vector& direction, float maxDistance, Physics::RaycastHit& out, const Physics::QueryFilter& filter);
94
96bool SegmentCast(IndexT scene, const Math::point& from, const Math::point& to, Physics::RaycastHit& out, const Physics::QueryFilter& filter);
97
99bool ShapeCast(IndexT scene, const Physics::QueryShape& shape, const Math::vector& direction, float maxDistance, Physics::ShapeCastHit& out, const Physics::QueryFilter& filter);
100
103bool ShapeCastAny(IndexT scene, const Physics::QueryShape& shape, const Math::vector& direction, float maxDistance, Physics::ShapeCastHit& out, const Physics::QueryFilter& filter);
104
106bool SphereCast(IndexT scene, const Math::point& center, float radius, const Math::vector& direction, float maxDistance, Physics::ShapeCastHit& out, const Physics::QueryFilter& filter);
107
109bool SphereCastAny(IndexT scene, const Math::point& center, float radius, const Math::vector& direction, float maxDistance, Physics::ShapeCastHit& out, const Physics::QueryFilter& filter);
110
112bool BoxCast(IndexT scene, const Math::transform& pose, const Math::vec3& halfExtents, const Math::vector& direction, float maxDistance, Physics::ShapeCastHit& out, const Physics::QueryFilter& filter);
113
115bool BoxCastAny(IndexT scene, const Math::transform& pose, const Math::vec3& halfExtents, const Math::vector& direction, float maxDistance, Physics::ShapeCastHit& out, const Physics::QueryFilter& filter);
116
117} // namespace Physics
Simple transform using position, quaternion, and scale.
Definition transform.h:18
Diverse functions for manipulating physics actors.
Definition actorcontext.cc:22
bool BoxCastAny(IndexT scene, const Math::transform &pose, const Math::vec3 &halfExtents, const Math::vector &direction, float maxDistance, Physics::ShapeCastHit &out, const Physics::QueryFilter &filter)
First hit found along a swept box. See Physics::ShapeCastAny.
Definition scenequery.cc:329
bool ShapeCastAny(IndexT scene, const Physics::QueryShape &shape, const Math::vector &direction, float maxDistance, Physics::ShapeCastHit &out, const Physics::QueryFilter &filter)
First hit found along a swept shape, which is not necessarily the closest.
Definition scenequery.cc:278
bool Raycast(IndexT scene, const Math::point &origin, const Math::vector &direction, float maxDistance, Physics::RaycastHit &out, const Physics::QueryFilter &filter)
Closest hit along a ray. The direction has to be normalized. False when nothing was hit.
Definition scenequery.cc:245
bool BoxCast(IndexT scene, const Math::transform &pose, const Math::vec3 &halfExtents, const Math::vector &direction, float maxDistance, Physics::ShapeCastHit &out, const Physics::QueryFilter &filter)
Closest hit along a swept box. The pose is the box at the start of the cast.
Definition scenequery.cc:315
bool SphereCastAny(IndexT scene, const Math::point &center, float radius, const Math::vector &direction, float maxDistance, Physics::ShapeCastHit &out, const Physics::QueryFilter &filter)
First hit found along a swept sphere. See Physics::ShapeCastAny.
Definition scenequery.cc:301
bool SegmentCast(IndexT scene, const Math::point &from, const Math::point &to, Physics::RaycastHit &out, const Physics::QueryFilter &filter)
Closest hit along a segment. The direction is the segment itself.
Definition scenequery.cc:254
bool ShapeCast(IndexT scene, const Physics::QueryShape &shape, const Math::vector &direction, float maxDistance, Physics::ShapeCastHit &out, const Physics::QueryFilter &filter)
Closest hit along a swept shape. The direction has to be normalized. False when nothing was hit.
Definition scenequery.cc:269
bool SphereCast(IndexT scene, const Math::point &center, float radius, const Math::vector &direction, float maxDistance, Physics::ShapeCastHit &out, const Physics::QueryFilter &filter)
Closest hit along a swept sphere.
Definition scenequery.cc:287
Represents a 3D point in space.
Definition point.h:22
A 3D vector.
Definition vec3.h:37
A vector is a 3D direction in space.
Definition vector.h:22
Definition physicsinterface.h:76
Definition scenequery.h:23
uint32_t mask
Definition scenequery.h:25
Physics::ActorId excludeActorId
Definition scenequery.h:26
uint32_t group
Definition scenequery.h:24
A shape a query sweeps through the scene.
Definition scenequery.h:84
Physics::ColliderType type
Definition scenequery.h:85
Math::transform transform
world pose of the shape at the start of the cast
Definition scenequery.h:87
float sphereRadius
Definition scenequery.h:89
Math::vec3 boxExtents
Definition scenequery.h:88
A raycast hit.
Definition scenequery.h:38
uint32_t shapeId
Definition scenequery.h:40
float distance
Definition scenequery.h:41
uint64_t entity
Definition scenequery.h:39
Math::vec3 normal
Definition scenequery.h:43
uint32_t faceIndex
Definition scenequery.h:44
Math::vec3 point
Definition scenequery.h:42
A shape cast hit.
Definition scenequery.h:65
uint32_t shapeId
Definition scenequery.h:67
Math::vec3 point
Definition scenequery.h:69
Math::vec3 normal
Definition scenequery.h:70
uint32_t faceIndex
Definition scenequery.h:71
float distance
Definition scenequery.h:68
uint64_t entity
Definition scenequery.h:66
int IndexT
Definition types.h:49