Hi,

it seems you don’t use the dot product on the good vectors.

Exept if your player character is in 0,0 you should do someting like this

//Point in space

```
FVector end1 = PlayerCharLoc
end1.X += 500
```

//Point in space

```
FVector end2 = PlayerCharLoc
end2.Y += 500
```

//Then calculate the direction vectors

```
FVector dir1 = end1 - playerChar
FVector dir2 = end2 - playerChar
dir1.Normalized()
dir2.Normalized()
```

//Do the dot product on dir1 and dir2

```
float dot = FMath::DotProduct(dir1, dir2)
```

//Calculate a cos

`float angle = ACos(dot)`

I’m trying to get the angle between two vectors using dot product + acos but keep getting weird results.

So, basically, there are two coordinate lines like X and Y, and I want Y to calculate and show the angle between itself and X, which should be 90 degrees.

But when I run the blueprint the ingame result is anything but expected:

On top of it, when I start to move the thing around ingame the angle starts to change.

What am I doing wrong?

Thank you! Problem resolved!

_

For others who might wonder how it looks like in blueprints:

Get actor location, then break the vector, then add +500 either on X or Y respectively, then make it vector again and then do vector minus vector node and subtract actor location to get “pure” (so to speak) vector out of it. Normalize the result and do DotProduct + acos to get the degrees.

Thank you again 42EspoiR !