[solved] get Horizontal X and Y distance

Hello everyone

i’m trying to build a system which require the distance between camera and pawn actor in the three dimensions X, Y, and Z
i can get the Z axis with GetVerticalDistance, but i can’t get X distance and Y distance SEPARATELY
please take a look at this image to understand what i mean:

the black line represent the return value of GetHorizontalDistance while i want to separate it to X and Y
the black line is represented by a^2 = x^2 + y^2

but i could get how to calculate what i need and i appreciate any help


Good morning,

GetVerticalDistance() = FMath::Abs((GetActorLocation().Z - OtherActor->GetActorLocation().Z))

It’s simply the difference between two floats.

So, in blueprint, it’s something like this:

BTW camera is already attached to character so it should when ever i move the pawn the camera move with it and distance should not changed
but i tried this but when ever character move it the value will change.

i finally solved it using the answer from this:

thanks alex