UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
UE::Math::TRay< T > Struct Template Reference

#include <Ray.h>

Public Types

using FReal = T
 

Public Member Functions

 TRay ()
 
 TRay (EForceInit)
 
 TRay (const TVector< T > &Origin, const TVector< T > &Direction, bool bDirectionIsNormalized=false)
 
void Init ()
 
bool operator== (const TRay< T > &Other) const
 
bool operator!= (const TRay< T > &Other) const
 
TVector< T > PointAt (T RayParameter) const
 
GetParameter (const TVector< T > &Point) const
 
DistSquared (const TVector< T > &Point) const
 
Dist (const TVector< T > &Point) const
 
TVector< T > ClosestPoint (const TVector< T > &Point) const
 
FString ToString () const
 
bool Serialize (FArchive &Ar)
 
bool SerializeFromMismatchedTag (FName StructTag, FArchive &Ar)
 
template<typename FArg UE_REQUIRES>
 TRay (const TRay< FArg > &From)
 

Public Attributes

TVector< T > Origin
 
TVector< T > Direction
 

Friends

FArchiveoperator<< (FArchive &Ar, TRay< T > &Ray)
 

Member Typedef Documentation

◆ FReal

template<typename T >
using UE::Math::TRay< T >::FReal = T

Constructor & Destructor Documentation

◆ TRay() [1/4]

template<typename T >
UE::Math::TRay< T >::TRay ( )
inline

Default constructor initializes ray to Zero origin and Z-axis direction

◆ TRay() [2/4]

template<typename T >
UE::Math::TRay< T >::TRay ( EForceInit  )
inlineexplicit

Creates and initializes a new Ray to Zero Origin and Z-axis Direction.

Parameters
EForceInitForce Init Enum.

◆ TRay() [3/4]

template<typename T >
UE::Math::TRay< T >::TRay ( const TVector< T > &  Origin,
const TVector< T > &  Direction,
bool  bDirectionIsNormalized = false 
)
inline

Initialize Ray with origin and direction

Parameters
OriginRay Origin Point
DirectionRay Direction Vector
bDirectionIsNormalizedDirection will be normalized unless this is passed as true (default false)

◆ TRay() [4/4]

template<typename T >
template<typename FArg UE_REQUIRES>
UE::Math::TRay< T >::TRay ( const TRay< FArg > &  From)
inlineexplicit

Member Function Documentation

◆ ClosestPoint()

template<typename T >
TVector< T > UE::Math::TRay< T >::ClosestPoint ( const TVector< T > &  Point) const
inline

Find closest point on ray to query point

Parameters
Pointquery point
Returns
closest point on Ray

◆ Dist()

template<typename T >
T UE::Math::TRay< T >::Dist ( const TVector< T > &  Point) const
inline

Find minimum distance from query point to ray

Parameters
Pointquery Point
Returns
distance to Ray

◆ DistSquared()

template<typename T >
T UE::Math::TRay< T >::DistSquared ( const TVector< T > &  Point) const
inline

Find minimum squared distance from query point to ray

Parameters
Pointquery Point
Returns
squared distance to Ray

◆ GetParameter()

template<typename T >
T UE::Math::TRay< T >::GetParameter ( const TVector< T > &  Point) const
inline

Calculate ray parameter (distance from origin to closest point) for query Point

Parameters
Pointquery Point
Returns
distance along ray from origin to closest point

◆ Init()

template<typename T >
void UE::Math::TRay< T >::Init ( )
inline

Set the initial values of the Ray to Zero Origin and Z-axis Direction.

◆ operator!=()

template<typename T >
bool UE::Math::TRay< T >::operator!= ( const TRay< T > &  Other) const
inline

Compares two Rays for inequality.

Parameters
OtherThe other Ray to compare with.
Returns
true if the Rays are not equal, false otherwise.

◆ operator==()

template<typename T >
bool UE::Math::TRay< T >::operator== ( const TRay< T > &  Other) const
inline

Compares two Rays for equality.

Parameters
OtherThe other Ray to compare with.
Returns
true if the Rays are equal, false otherwise.

◆ PointAt()

template<typename T >
TVector< T > UE::Math::TRay< T >::PointAt ( RayParameter) const
inline

Calculate position on ray at given distance/parameter

Parameters
RayParameterScalar distance along Ray
Returns
Point on Ray

◆ Serialize()

template<typename T >
bool UE::Math::TRay< T >::Serialize ( FArchive Ar)
inline

◆ SerializeFromMismatchedTag()

template<typename T >
bool UE::Math::TRay< T >::SerializeFromMismatchedTag ( FName  StructTag,
FArchive Ar 
)
inline

◆ ToString()

template<typename T >
FString UE::Math::TRay< T >::ToString ( ) const
inline

Get a textual representation of the Ray.

Returns
Text describing the Ray.

Friends And Related Symbol Documentation

◆ operator<<

template<typename T >
FArchive & operator<< ( FArchive Ar,
TRay< T > &  Ray 
)
friend

Serializes the Ray.

Parameters
ArThe archive to serialize into.
BoxThe box to serialize.
Returns
Reference to the Archive after serialization.

Member Data Documentation

◆ Direction

template<typename T >
TVector<T> UE::Math::TRay< T >::Direction

Ray direction vector (always normalized)

◆ Origin

template<typename T >
TVector<T> UE::Math::TRay< T >::Origin

Ray origin point


The documentation for this struct was generated from the following files: