| 06-14-2005, 11:09 PM | #1 |
ok, this is probably really complex and i shouldnt even be asking about it, but i was thinking about making a cinematic, and i needa know how to make a unit "jump" as in liek moving the unit slowly in an arc. if you know how to do this pls post like an example trigger for it so i can look at it and get the idea... thx |
| 06-15-2005, 12:01 AM | #2 |
set the height of the unit in a loop along a sin curve EDIT: Something like this: Code:
function Trig_Jump_Actions takes nothing returns nothing
local real a = 0
local real x = 0
local real y = 0
loop
exitwhen a == bj_PI
//PLAY AROUND WITH *100
call SetUnitFlyHeight(gg_unit_Hpal_0000, Sin(a)*100, 100)
//PLAY AROUND WITH + 10
set x = GetUnitX(gg_unit_Hpal_0000) + 10 * Cos(GetUnitFacing(gg_unit_Hpal_0000) * bj_DEGTORAD)
//PLAY AROUND WITH +10
set y = GetUnitY(gg_unit_Hpal_0000) + 10 * Sin(GetUnitFacing(gg_unit_Hpal_0000) * bj_DEGTORAD)
call SetUnitPosition(gg_unit_Hpal_0000, x, y)
//PLAY AROUND WITH /20
set a = a + (bj_PI / 20)
//PLAY AROUND WITH .001
call PolledWait(.001)
endloop
endfunction
//CHANGE THE EVENT TO WHATEVER YOU WANT IT TO BE
//THIS MAKES THE JUMP RUN AT 5 SECONDS ELAPSED
//===========================================================================
function InitTrig_Jump takes nothing returns nothing
set gg_trg_Jump = CreateTrigger( )
call TriggerRegisterTimerEventSingle( gg_trg_Jump, 5 )
call TriggerAddAction( gg_trg_Jump, function Trig_Jump_Actions )
endfunction |
| 06-15-2005, 01:20 AM | #3 |
whoa, pretty crazy. bliz should just put in "create curve" and "slide unit along curve" functions. thx but i probably wont mess with it lol |
| 06-15-2005, 01:43 AM | #4 |
You probably should, as I only got it working OK. The jump doesn't look amazing with those numbers. Maybe someone else can come and help you with the specifics. Also, remember to replace gg_unit_Hpal_0000 with whatever unit you want to jump. |
| 06-15-2005, 08:19 AM | #5 |
really its not necessary to follow a sinusoidal path, actually, standard kinematics make things much easier... well, not really, but more comprehensible its much easier just to use a parabolic arc, ie move the unit in set intervals along the XY-plane each tick, and start the Z velocity at say 80, and each tick add CONST_GRAVITY which you define to be, say -10, to the velocity, and add the velocity to the units current Z height |
| 06-15-2005, 02:15 PM | #6 | |
Quote:
Let us see your function for doing this =) I think it might be easier to comprehend as well. |
