Classes

Physics/Raycast

Brief descriptions

Structures

nau::physics::RayCastQuery

Encapsulates raycasting query settings.

nau::physics::RayCastResult

Encapsulates ray hit information.

Detailed information

physics::RayCastQuery

engine/core/modules/physics/include/nau/physics/physics_raycast.h

struct RayCastQuery

Encapsulates raycasting query settings.

Public Members

uint32_t id = 0
math::vec3 origin

World coordinates of the ray start.

math::vec3 direction

Direction of the ray.

It is expected to be normalized.

TFloat maxDistance = eastl::numeric_limits<TFloat>::max()

Length of the ray. Anything beyond this length will not be reported as a hit.

eastl::vector<CollisionChannel> reactChannels

List of channels the ray should hit.

Empty list means the ray should hit any channel.

bool ignoreTriggers = false

Indicates whether the ray should ignore or hit triggers.

float debugDrawDuration = {0}

Duration for which the ray should be visualized.

Note

Drawing rays only works in Debug mode.


physics::RayCastResult

engine/core/modules/physics/include/nau/physics/physics_raycast.h

struct RayCastResult

Public Functions

inline explicit operator bool() const
inline bool hasTarget() const

Public Members

uint32_t queryId = 0
Uid sceneObjectUid = NullUid

Scene object body is attached to.

scene::ObjectWeakRef<physics::RigidBodyComponent> rigidBody

Physical body that caused the hit.

nau::physics::IPhysicsMaterial::Ptr material

Material of the body collider sampled at the position.

math::vec3 position

Coordinates of the hit.

math::vec3 normal

Normal vector to the hit body collider surface sampled at the position.