I’ve a problem.
I want to show a hit indicator when my character takes damage with direction from where it is coming. From Event AnyDamage. I want it to look like Unreal tournament hit indicator.
I can show hit indicator but problem is getting the direction/side whether it came from Left, Right, Front or Back. Or may be some angle.
To get the direction following is what I am doing
Normalize (Damage Causer location - Player Location) but I don’t know it is proper way or not.
How do I go for this?
It looks fine. You can also show the direction as relative to the current rotation of the player by doing something like this:
Edit: I just re-read that you’re after Front/Back as well, just follow the same principle and use GetForwardVector
To get direction as when we looking upside down we should throw out Z, actually multiply “Direction” vector by (1,1,0), then normalize.
Now the same way from player look direction.
Now you can use “Rotate by vector” to turn look direction vector by hit direction vector. And you can find angle between those vectors, I would have used arccosinus of dot product multiplied by sign of cross product, but I sure there is a way faster way in one node. So on you have offset from screen center (you also need to multiply it by some number to make further from center) and angle you need to rotate hit marker, just transfer these two parameters as event into HUD and do all marker spawning there, this is very important to correctly distribute work between classes.
What to do cause if i check with if it will give me two direction still i.e. one from right and left group and one from up down group.
can you show it in blueprint. Sorry but i am a novice. I’ll post what i did and please correct me if I am wrong.
I’ve even figured out how to make it simple.
Desired angle goes to HUD as rotation for marker, and you can use “Make From X” node to get rotator vector what can be used as offset for marker.
thanks for showing me path sire.