Quote:
Originally Posted by Luigi203
How about bringing some PRODUCTIVITY to your posts?
|
Not allowed linking to external sites!
Quote:
verticalspeed = sin(zangle)*s
verticalspeed -= .1 every .05 seconds
horizontalspeed = cos(zangle)*s
x = x + cos(angle)*horizontalspeed
y = y - sin(angle)*horizontalspeed
z = z + verticalspeed
zangle = -pi/10
initial z = 8
initial x = 0
initial y = 0
I need it so when z = 0, x,y = finalx,finaly
z = 0, x = finalx, y = finaly
|
Solve for T:
PHP Code:
fy = y + vt + 1/2 * gt^2
v = v + gt
a = g ( In the case of Graal, 2 )
With v decreasing every 0.05 seconds of 0.1... It means the velocity is...
v = sin(zangle)*power + 2t
Now...
PHP Code:
0 = y + v(0)t + 1/2 * g(0)t^2
0 = y + sin(zangle)*power * t + t^2
Using the Pythagreom Theorum:
PHP Code:
t = (-b +- (b^2 - 4AC)^0.5)/2A
t = (-sin(zangle)*power +- ((sin(zangle)*power)^2 - 4*y)^0.5)/2;
This gives you two t's... Usually, there are two ways to reach a point using this... One is going very high up, and falling short... Or... Going very low, and very far... The higher up one takes longer for the same location ( more distance to cover ).
Now that you got t...
You can solve your location you want by...
PHP Code:
fx = x + sin(angle)*t
fy = y + cos(angle)*t
But! Because Graal coordinates go from 0 to 64, and no 64 to 0... It means your grid is inversied...
PHP Code:
fy = y - cos(angle)*t
=] And you know where the projectile should land....
This is inaccurate in the sense that the speed is decreased only every 0.05 seconds, and so, the accelleration is actually an step-function. This means that for the period of 0-0.05, it decreases in an instance, rather than gradually, like in real life. It also means that it has the possibility to be off, but... Not by much.

; That's off the top of my head. I didn't check if I made mistakes.