Download

Determine angle between player direction and wall

Hi everybody,

I recently started working with UE4 Blueprint and learning a lot, but I am still pretty new to it. However at the moment I am stuck. I need to somehow determine the angle between the direction the player direction and the wall he/she is approaching. I did some research and ended up with the conclusion I am probably going to need to use the Dot Product and some vectors but I can’t seem to find the right nodes. Can anyone provide a solution to what I am trying to do? Also it would be a great help if you could elaborate as to why I should use said solution.

Thanks in advance

hi
can you draw what exactly you need?

Imgur

Here is an image. I need to determine the angle between A and B indicated by X. The P indicates the player.

here is a solution , hope it helps

since i had to deal with that stuff alot… i assume this wont really work if the wall is rotated or the actor wich holds the wall ill put up a example node network, wich handeles Player & Actor rotation tomorrow when i get home… its late… i need sleep :slight_smile:

Edit: Fun part is that the UE4 Rotation system works from -180 to 180 degree

You can turn if from -180/180 to 360 degree btw quite easily.

Yes i know(map range for example) still if you add a rotation of 90 to a rotator part like yaw sample value 180 you get 270 for example not -90

Or you can use dot product or cross product of two vectors.

And here is my problem, did anybody found names of those nodes in blueprints?

Edit: I read op second time and this time my fast reading did not skip information that he also has same problem with dot product.

Ps. do not train fast reading when you have myeopia, ie. bad sight.

I don’t why do you want to know the angles. But if it is only to know if it is left or right of the player, this is what I use and it works for me: