vkmEngine 1.0.0
A C++ game engine · vkmengine.com
Loading...
Searching...
No Matches
query.h
1#pragma once
2
3#include <glm/glm.hpp>
4
5#include "ecs/entity.h"
6
7namespace Vkm::Engine {
8
9class Scene;
10
17struct RayHit {
19 float distance = 0.0f;
20 glm::vec3 point = {0.0f, 0.0f, 0.0f};
21 glm::vec3 normal = {0.0f, 1.0f, 0.0f};
22};
23
31 bool hitTriggers = false;
32 bool hitStatic = true;
33 bool hitDynamic = true;
34
38 int layerMask = ~0;
39};
40
56bool raycast(
57 Scene& scene,
58 const glm::vec3& origin,
59 const glm::vec3& direction,
60 float maxDistance,
61 RayHit& out,
62 const QueryFilter& filter = {}
63);
64
80bool spherecast(
81 Scene& scene,
82 const glm::vec3& origin,
83 float radius,
84 const glm::vec3& direction,
85 float maxDistance,
86 RayHit& out,
87 const QueryFilter& filter = {}
88);
89
90} // namespace Vkm::Engine
Central registry managing entities and an open set of component types.
Definition scene.h:29
Names one entity of one Scene, for as long as that slot holds it.
Definition entity.h:23
Which bodies a query is allowed to see.
Definition query.h:29
int layerMask
Which layers may be hit, as a mask of the bits collision uses; everything by default.
Definition query.h:38
EntityId ignore
Never hit; the caster, usually.
Definition query.h:30
bool hitTriggers
Include colliders marked isTrigger.
Definition query.h:31
bool hitStatic
Include Static and Kinematic bodies, by their authored motion.
Definition query.h:32
bool hitDynamic
Include Dynamic bodies, a ragdoll's posed bones among them.
Definition query.h:33
What a query struck: which entity, where, and the surface it hit.
Definition query.h:17
EntityId entity
The body that was struck.
Definition query.h:18
glm::vec3 normal
Outward surface normal.
Definition query.h:21
glm::vec3 point
World-space contact point.
Definition query.h:20
float distance
Along the ray, in metres.
Definition query.h:19