Insane!
Shh I didn't edit this, go away.
- Reaction score
- 122
i want to change a units angle like how light hits a mirror. how would i do this?
come on you're garunteed rep!
come on you're garunteed rep!
local unit mirror = <your unit>
local unit u = GetTriggerUnit ()
local real uface = GetUnitFacing (u)
local real mface = GetUnitFacing (mirror)
local real dif = mface - uface
local real exitangle = uface + dif
call SetUnitFacing (u, exitangle)
set u = null
//This is based on a Within Range event, I would guess <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite7" alt=":p" title="Stick Out Tongue :p" loading="lazy" data-shortname=":p" />
//Not sure whether SetUnitFacing takes the angle in degs or rads (just use Deg2Rad (exitangle) if it takes rads)
//Also, this is based on unit facing the mirror when in range (if the unit was sliding with his back to the mirror, something weird would result)
//You can use XY coordinates and Atan2 (y2-y1, x2-x1) to get the angle (in rads) between 2 sets of coordinates if the above situation could occur