HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

[GUI] Perfect Animation

05-20-2009, 07:08 PM#1
Idontneedaname
Hey all!
Just because I was bored, I recently started to make a new map: It's the Leaping Strike, yeah, everyone has at least seen it once, blablabla.
For those who don't: We have a blademaster, he jumps to a target while doing the critical-strike-animation, hits it and causes a bloody massacre. The jump was quite easy actually. The problem which seems to love me is that the animation is either too fast or too slow, he never really hits the target. I tried to code that the animation speed gets corrected every step he makes while jumping, but I failed.

Map Mechanics

The jump works as a parabola, via ax²+bx+c; udg_Real_Numbers[9] is the a, uRN[10] is the b - we don't need the c, because the starting point is defined as P(0/0) in the coordinate-system. These should be correct.
uRN[6] is the speed he has in the horizontal direction. Remember, that's not his actual speed, you could say it's the speed of his shadow on the ground under him.
uRN[7] is the distance between his position and his targets position. Again, not the real distance, but the x-distance.
uRN[8] is the height difference, this should be clear.

The Blademaster does not jump right into the unit, more like shortly before it. He shall land 100 Idontknowwhat before his victim.

What I tried to code for the animation speed is: At the start of the jump:
((Original_Animation_Length* 100(<- because of the percent calculation))/Jump_Time) => (Original_Animation_Length*His_Speed* 100) / Distance => (1.133*uRN[6]*100)/uRN[7])
This alone should work, but it doesn't. So I made the correction inside the trigger. The 1.133 gets subtracted by the evaded time and the uRN[7] gets replaced by the current distance of the BM and the target point.



Why I made it in GUI? Because I'm a lazy person.
Do I know that it possibly leaks? Yes, but at least I tried to fix that.

Here's the link:
05-20-2009, 08:16 PM#2
Anitarf
Quote:
Why I made it in GUI? Because I'm a lazy person.
No, it's because you're a masochist.
05-21-2009, 03:06 AM#3
Dark.Revenant
Create a function that gets the absolute time of the jump. This might require summation calculus, or at least a masochistic application of algebra.

Once you have that in a temporary real variable, it's a simple matter of arithmetic from there.

Now, keep in mind the "hit" part of the critical strike animation hits before the animation is done.
05-21-2009, 08:56 AM#4
Idontneedaname
Quote:
Originally Posted by Anitarf
No, it's because you're a masochist.

I somehow doubt that.
Theoretically, I do have the jump time: the jump distance divided by his speed on the x-axis. That's why I don't get why it doesn't work.
05-21-2009, 09:26 AM#5
Anitarf
I don't see why you should have a problem with this, it's entirely possible to give the jump a fixed duration, thus avoiding any sort of animation problems.
05-21-2009, 10:20 AM#6
Idontneedaname
This is true ofc. I had several possibilities for the jump, but I wanted to take the most realistic one. If the BM jumps 700 distance in 1.5 seconds and 300 d. in 1.5 seconds, it'll look weird.
05-21-2009, 10:48 AM#7
grim001
The easiest thing to do is to dynamically set the unit's animation timescale with each iteration, keeping it on track to hit the right point in the animation just as it reaches the target. The math for this isn't too complicated, you should probably be able to figure it out. The animation speed doesn't stay constant, but the difference is too subtle to notice, and it works even if your target is running toward or away from you during the jump.
05-21-2009, 07:02 PM#8
Idontneedaname
Quote:
Originally Posted by Dark.Revenant
Create a function that gets the absolute time of the jump. This might require summation calculus, or at least a masochistic application of algebra.

Once you have that in a temporary real variable, it's a simple matter of arithmetic from there.

Now, keep in mind the "hit" part of the critical strike animation hits before the animation is done.

Okay, I got it. You, sir, are awesome :) +Rep
05-21-2009, 07:56 PM#9
Bobo_The_Kodo
It takes exactly 0.8 seconds for the sword to hit the ground in the animation

I use 0.7625 for a time to do damage, it looks fine