TargetLocation is already B-A bc it’s relative to A(our cube). There’s no need to solve for B. Additionally, in the example code bellow, Direction and DirectionTwo are equivalent.
FVector Direction = TargetLocation.GetSafeNormal(); // is the same as
FVector DirectionTwo = (GetTransform().TransformPosition(TargetLocation) - GetActorLocation()).GetSafeNormal();
Here’s my debuger screen shot, so you can see the values of TargetLocation and BminusA are the same as well as Direction and DirectionTwo are the same.
Just for reference, here’s that chart
I’ve been really chewing on Vector Math for the past week, I’m glad it’s sticking. Thanks GDTV!
On a side note, I’ve never been able to evaluate an expression while debugging. For example, GetTransform().TransformPosition(TargetLocation)
would generate an error in the evaluator. Is there a way to get it working properly?