Need help to find the angle or direction of the character compared to the other character

I have a player character and a horse character. I could stand to its left/right/rear and use a sphere trace to detect the horse. Based on the sphere trace, I’m trying to figure out if I’m on the horse’s left/right/behind/front. Based on knowing that I am planning to play the correct mount animation.

I’ve posted two images so that you can visualize the problem and a graph that shows my attempt.

I know how to do it using box collisions. My cursor that you see in the middle of the screen is the selector. I can only interact with objects when my cursor is over it and I’m nearby.

But I’m trying to solve this issue only using sphere trace and whatever other nodes can help me with this.

After some search, I tried this approach but it always returns zero. IF I only use the dot product part of it. It gives some values but sort of useless, since It doesn’t tell me what I need.

A simple solution is: place one collision box around the horse for interaction then the following will work.

if the impact normal is same as forward vector, you are hitting the horses front, if impact normal is same as right vector then it right, and if it’s the opposite etc, works regardless of direction horse is facing.


I ended up adding three box collision and ditched front collision for now. Then added a sphere trace for objects to detect only world static. If I use the existing one, it doesn’t always work and sometimes instead of returning left/right/rear box collision string, it returns the horse’s instance name I guess. So here how it looks. This seems to work mostly. I still have to try "Basement Bob"s approach.