raycastAll

Script::raycastAll

Casts a ray and returns information about the hit Entities.

Declaration

std::vector<std::pair<Entity, RaycastInformation>> raycastAll(const Math::vec3& rayOrigin, const Math::vec3& rayDirection, float tMin = 0.0001f, float tMax = 1000000.0f);

Parameters

Name

Type

Description

rayOrigin

const Math::vec3&

The origin position of the ray, in world-space.

rayDirection

const Math::vec3&

The direction of the ray.

tMin

float

The minimum distance to check.

tMax

float

The maximum distance to check.

Returns

An std::vector of an std::pair <https://en.cppreference.com/w/cpp/utility/pair> of Entity and RaycastInformation containing information about the hit Entities.

The returned list is sorted from the closest to the furthest object. RaycastInformation::hasIntersected will always be true.

If no Entity has been hit, the returned list is empty.