mirror effect

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!
 

Exide

I am amazingly focused right now!
Reaction score
448
You mean pitch angle?
I don't think it's possible. :(
You can make a model that's pitched, though.
 

Flare

Stops copies me!
Reaction score
662
I think the reflection angle is Entrance angle + 2x(Mirror angle - entrance angle).

Entrance angle being the angle at which the target hit the mirror (this is based on a quick scenario i made out in my head :p)

Unit travels straight left (180 deg)
There's a mirror placed at going from down-left to up-right (45 or 225 degrees)

so, if you took 45 as the angle
45 - 180 = -135
2x-135 = -270
180+(-270) = -90
-90 = 270 degree reflection (with regards to angles, -90 = 270 :p you can add 360 if you want)

if you took 225 as the angle
225-180 = 45
2x45 = 90
180+90 = 270 degree reflection


now, lets take a different mirror angle (lets say... 190 (or 10, both would be applicable) to make it a very slim angle)
190-180 = 10
2x10 = 20
180 + 20 = 200 degree reflection

but that would only work on XY plane (WC3's XY plane i.e. the ground). dont know if this would apply if you were trying to reflect into the air

EDIT: decided to do some googling, and found this
http://www.glenbrook.k12.il.us/gbssci/phys/class/refln/u13l1c.html

it has an animation which demonstrates the stuff i said above
 

Flare

Stops copies me!
Reaction score
662
it can be done in GUI if you wish.

this SHOULD work for JASS (im just taking it from memory though)
JASS:
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
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top