FMath::GetDotDistance

Calculates the dotted distance of vector 'Direction' to coordinate system O(AxisX,AxisY,AxisZ).

Windows
MacOS
Linux

References

Module

Core

Header

/Engine/Source/Runtime/Core/Public/Math/UnrealMathUtility.h

Include

#include "Math/UnrealMathUtility.h"

Source

/Engine/Source/Runtime/Core/Private/Math/UnrealMath.cpp

Syntax

static bool GetDotDistance
(
    FVector2D & OutDotDist,
    const FVector & Direction,
    const FVector & AxisX,
    const FVector & AxisY,
    const FVector & AxisZ
)

Remarks

Calculates the dotted distance of vector 'Direction' to coordinate system O(AxisX,AxisY,AxisZ).

Orientation: (consider 'O' the first person view of the player, and 'Direction' a vector pointing to an enemy)

  • positive azimuth means enemy is on the right of crosshair. (negative means left).

  • positive elevation means enemy is on top of crosshair, negative means below.

@note 'Azimuth' (.X) sign is changed to represent left/right and not front/behind. front/behind is the funtion's return value.

Returns

true if 'Direction' is facing AxisX (Direction dot AxisX >= 0.f)

Parameters

Parameter

Description

OutDotDist

.X = 'Direction' dot AxisX relative to plane (AxisX,AxisZ). (== Cos(Azimuth)) .Y = 'Direction' dot AxisX relative to plane (AxisX,AxisY). (== Sin(Elevation))

Direction

direction of target.

AxisX

X component of reference system.

AxisY

Y component of reference system.

AxisZ

Z component of reference system.

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss