![]() |
vkmEngine 1.0.15
A C++ game engine · vkmengine.com
|
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. | |
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.
| 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.
| scene | Scene whose bodies are asked. |
| filter | Which bodies may be hit. |
| around | Where the rays will run, in world space. |
| 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.
| origin | World-space start of the ray. | |
| direction | Any non-zero vector; normalized internally. | |
| maxDistance | How far to look, in metres; non-positive finds nothing. | |
| [out] | out | The nearest hit, ties to the lower entity slot; untouched on false. |
maxDistance.