[Solved]LF a better way how to make this


I created a function yesterday, it works, but it’s a mess.

This function just switches between front and back of the character, depending on the current camera rotation. But, the second InRange float, Division, AND are just there to workaround the issues i have with it :frowning:

There must be a better, easier way how to do it, i just don’t see it. LF help, ideas.

Interesting node that fixed a lot, is ‘Get Control Rotation’ (Pawn as target). For example, Camera and Player Character now share the same start rotation.

Latest attempt so far, still wondering tho… isn’t there a better way how to make angle from the current pawn direction other than using subtraction/addition nodes?

Dot product is cosine between 2 vectors (you need normalize input vectors first)

So dot product will tell you cosine, now you see if its more or less than zero. To see if its left/right make dot between right vector and camera. To see forward/back you do dot between forward of character and camera. Ofc all vectors must be normalized before feeding to dot product.

If you want only horizontal angle multiply vectors by [1,1,0] this will nullify Z, then normalize them.

You also can project vectors onto plane and see angle between them on that plane.

Here is the result… i used also the normalize vector node, but that had no effect. Why should i normalize it then?