- Joined
- Jan 30, 2020
- Messages
- 781
Edit: (unrefined) Solution in last post by me
Using Relativistic Missiles [vJASS][LUA][GUI] for projectiles.
Given a projectile going in the red direction, when hitting a cliff, go in blue direction.
There are (at most) 2 ways it can reflect and make sense, but how do I test what's the correct one?
Basically, how do I detect what "normal" to "fake" for the reflection?
I have a test map with the system and this projectile
Also, how do I bounce? It seems that I need to specify new point rather than adjusting the angle. In my case, this seems pretty annoying. I kinda just want to let it travel for ~4 seconds or ~4000 units (but deflect resets the "travel" variable, so that's unusable for me) going straight ahead unless hitting a cliff...
Testmap is for 1.31, but I can open latest version too. I use vjass-edition.
Edit: I only care about "straight cliffs". I.E. what's in the test map.
Using Relativistic Missiles [vJASS][LUA][GUI] for projectiles.
Given a projectile going in the red direction, when hitting a cliff, go in blue direction.
There are (at most) 2 ways it can reflect and make sense, but how do I test what's the correct one?
Basically, how do I detect what "normal" to "fake" for the reflection?
I have a test map with the system and this projectile
JASS:
struct BounceTest extends Missiles
method onFinish takes nothing returns boolean
call BJDebugMsg("Finished")
return true
endmethod
method onHit takes unit u returns boolean
if u != source and UnitAlive(u) and not BlzIsUnitInvulnerable(u) and not IsUnitAlly(u, owner) then
call BJDebugMsg("Hit Enemy")
return true
endif
return false
endmethod
method onCliff takes nothing returns boolean
//call bounce()
//Want to set angle, aka: this.origin.angle to the reflection angle, but how to test what normal to use?
call BJDebugMsg("onCliff")
return false
endmethod
static method setupMissile takes unit c, real x, real y, real angle returns nothing
local real z = GetUnitFlyHeight(c) + 70.0
local real tx = x + 4000. * Cos(angle)
local real ty = y + 4000. * Sin(angle)
local thistype this = thistype.create(x, y, z, tx, ty, 60.0)
set source = c
set model = "Abilities\\Weapons\\SpiritOfVengeanceMissile\\SpiritOfVengeanceMissile.mdl"
set speed = 1000.
set collision = 32.
set damage = 5.0
set owner = GetOwningPlayer(c)
call launch()
set c = null
endmethod
endstruct
function FireMissile takes unit u returns nothing
call BounceTest.setupMissile(u, GetUnitX(u), GetUnitY(u), GetUnitFacing(u) * bj_DEGTORAD)
endfunction
Also, how do I bounce? It seems that I need to specify new point rather than adjusting the angle. In my case, this seems pretty annoying. I kinda just want to let it travel for ~4 seconds or ~4000 units (but deflect resets the "travel" variable, so that's unusable for me) going straight ahead unless hitting a cliff...
Testmap is for 1.31, but I can open latest version too. I use vjass-edition.
Edit: I only care about "straight cliffs". I.E. what's in the test map.
Attachments
Last edited: