What is the C++ equivalent of the Get Direction Vector node in blueprints?

Alright, apparently it’s just:

direction = target - currentLocation

Check out some vector math, the result of subtracting two points in space is a vector between them.

From Game Engine Architecture:

direction + direction = direction
direction – direction = direction
point + direction = point
point – point = direction
point + point = nonsense (don’t do it!)

It’s not.
The GetDirectionVector outputs a normalized vector, which has the difference with the vector obtained by subtraction that it’s length is equal to 1.

UKismetMathLibrary::GetDirectionUnitVector

1 Like

You can easily find the normalized vector by doing the following math:

This will also work too.