vkmEngine 1.0.15
A C++ game engine · vkmengine.com
Loading...
Searching...
No Matches
Vkm::Engine::QueryParts Class Reference

The parts a QueryFilter lets queries see, placed once for many rays in one moment. More...

#include <query.h>

Public Member Functions

void gather (Scene &scene, const QueryFilter &filter, const Math::AABB &around)
 Place every part filter lets through whose world bound meets around.
bool raycast (const glm::vec3 &origin, const glm::vec3 &direction, float maxDistance, RayHit &out) const
 Cast a ray against the gathered parts, as raycast casts it against the scene.

Detailed Description

The parts a QueryFilter lets queries see, placed once for many rays in one moment.

raycast walks every body per call, which suits gameplay's few casts. A caller casting many at once gathers the parts around where its rays run, once, and casts against those. It answers as raycast would at gather(): a body moved since is struck where it was, and no Collider may be added, removed or edited before the last cast, for it holds them.

Member Function Documentation

◆ gather()

void Vkm::Engine::QueryParts::gather ( Scene & scene,
const QueryFilter & filter,
const Math::AABB & around )

Place every part filter lets through whose world bound meets around.

Parameters
sceneScene whose bodies are asked.
filterWhich bodies may be hit.
aroundWhere the rays will run, in world space.

◆ raycast()

bool Vkm::Engine::QueryParts::raycast ( const glm::vec3 & origin,
const glm::vec3 & direction,
float maxDistance,
RayHit & out ) const

Cast a ray against the gathered parts, as raycast casts it against the scene.

Parameters
originWorld-space start of the ray.
directionAny non-zero vector; normalized internally.
maxDistanceHow far to look, in metres; non-positive finds nothing.
[out]outThe nearest hit, ties to the lower entity slot; untouched on false.
Returns
True when something was struck within maxDistance.

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