- #1
wraithseeker
- 29
- 0
I can explain them by 2 ways, I am making some sort of a game. I am doing a some sort of a knockback but the unit will be flying.
Imagine that the knockback ends only when the speed of the knockback is <= 0 and there is decrement & speed which is user specified.
The unit is moved by a timeframe of 0.03 seconds and gravity = -981. I know it is initially 9.81 but in the game it is calculated as -981.
Every 0.03 seconds until speed <= 0, speed is constantly reduced by decrement and how would I go about making the unit perform a parabola from point A (initial position of the unit) to point B(final area).
I do not really know how to calculate distance with speed and decrement but is it like
-1 * speed * speed / (2 * -decrement / Timeframe)
And I want to know how can I get the time of the knockback.
?
In another way I could say it like unit A has 3 vectors. Vector position, acceleration and velocity(They get updated every timeframe). Position stores the position of the unit and acceleration is actually deacceleration as it is negative. Velocity is just initial speed of the unit and gets decreased every timeframe by acceleration.
Velocity vector adds the acceleration and then Position vector adds the velocity every timeframe. The knockback would end when the dotproduct of velocity and acceleration >= 0.
Distance used to calculate is the same as the following one above.
So How would I go about doing a perfect parabola?
Imagine that the knockback ends only when the speed of the knockback is <= 0 and there is decrement & speed which is user specified.
The unit is moved by a timeframe of 0.03 seconds and gravity = -981. I know it is initially 9.81 but in the game it is calculated as -981.
Every 0.03 seconds until speed <= 0, speed is constantly reduced by decrement and how would I go about making the unit perform a parabola from point A (initial position of the unit) to point B(final area).
I do not really know how to calculate distance with speed and decrement but is it like
-1 * speed * speed / (2 * -decrement / Timeframe)
And I want to know how can I get the time of the knockback.
?
In another way I could say it like unit A has 3 vectors. Vector position, acceleration and velocity(They get updated every timeframe). Position stores the position of the unit and acceleration is actually deacceleration as it is negative. Velocity is just initial speed of the unit and gets decreased every timeframe by acceleration.
Velocity vector adds the acceleration and then Position vector adds the velocity every timeframe. The knockback would end when the dotproduct of velocity and acceleration >= 0.
Distance used to calculate is the same as the following one above.
So How would I go about doing a perfect parabola?