Partilhar via


Struct RayCastHit

Contains information about a single raycast hit.

struct Microsoft::Azure::RemoteRendering::RayCastHit

Fields

HitObject

The Entity that was hit with the raycast.

ApiHandle<Microsoft::Azure::RemoteRendering::Entity> HitObject{};

SubPartId

The ID or index of the part that was hit.

This can be used to get the Material at the raycast intersection. First query for the MeshComponent, then query for the material using MeshComponent.UsedMaterials[SubPartId].

int32_t SubPartId{};

HitPosition

The world space position where RayCastHit.HitObject was hit.

Microsoft::Azure::RemoteRendering::Double3 HitPosition{};

HitNormal

The world space normal where RayCastHit.HitObject was hit.

Microsoft::Azure::RemoteRendering::Float3 HitNormal{};

DistanceToHit

Distance along the normalized ray direction to the hit.

RayCast.StartPos + normalize(RayCast.EndPos - RayCast.StartPos) * RayCastHit.DistanceToHit == RayCastHit.HitPosition

double DistanceToHit{};

HitType

Classifies the face type of the hit. See RayHitType for the distinct face types.

Microsoft::Azure::RemoteRendering::RayHitType HitType{};

See also