Sorry, forgot to mention. In relation to where it is facing. Also, I need it for X and Y coordinates.Its not hard to determine the angle from which a unit is attacked.
Set Loc[1] = Position of attacking unit
Set Loc[2] = Position of attacked unit
Set Angle = Angle between Loc[2] and Loc[1]
call RemoveLocation(udg_Loc[1])
call RemoveLocation(udg_Loc[2])
Do you mean some way of determining the angle from the unit that is attacked in relation to where its facing and where the attacker is standing?
I did, but I found only from the back.I cant wrap my head around these angles. I am about 100% sure that others have already dealt with this issue. Have you tried making some searches?
I am looking to determine the angle of the attack relative to the attacked unit facing. So, backstab would be somewhere between 30 and 330 degrees, and front attack somewhere between 150 and 210. I need the angle from which the unit got attacked as the output (from 0 to 360). Ideally, an efficient formula in Jass. The only problem I have is with the math part.Not sure what you looking for, can you give an example?
Because, the function is already in the editor:
The attacked event isn't really precise btw, you would be better off using Bribe's Damage System and fire angle calculations upon damage dealt.
AngleTest
Events
Unit - A unit Is attacked
Conditions
Actions
Set VariableSet temp_real = (Facing of (Attacking unit))
Floating Text - Create floating text that reads (String(temp_real)) at (Position of (Attacking unit)) with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
Floating Text - Change (Last created floating text): Disable permanence
Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
Floating Text - Change the fading age of (Last created floating text) to 3.00 seconds
I guess you are looking for backstab damage or front/side-only shield block?
I am pretty sure you can set the OutputAngle to OutputAngle + -180 for the front then.I did, but I found only from the back.
This does not take into account facing.57.296*math.atan(TargetUnitY-UnitY,TargetUnitX-UnitX)
I don't need only back and front. As I said, I need an output from 0 to 360I am pretty sure you can set the OutputAngle to OutputAngle + -180 for the front then.
?? You asked for formula to find angle of attack and that I gave.This does not take into account facing.