I am building a game, where I have to plot a trajectory of a ball in 3D space, launched with an inital velocity Sx, Sy, Sz. [I am using OpenGL and Android-NDK]
Lets assume Sz is always 0. And Sx and Sy values are known.
Now, I am able to plot a dotted trajectory properly along the path taken by the ball, under uniform gravity. But, the problem is that the distance between the points are NOT EQUIDISTANT, since I am plotting them at regular time intervals.
So, the next step for me is to plot the trajectory at intervals (tn) such that my distance traveled (d) is always fixed.
Now, assume I want to plot the "nth" trajectory point for every "d" units of distance. So, I need 'tn' to plot it.
I have tried solving this on white board, but the resulting equation for 'tn' is too complex. And I could get this far :
d^2 = dx^2 + dy^2;
dx = Sx * t; | t = dx/Sx;
dy = Sy * t + 1/2 (g) (t^2); | dy = Sy * (dx/Sx) + 1/2 (g) ((dx/Sx)^2);
So t = 'gives me an equation that has a highest order of 4';
I am hoping there must be a better way. Can anyone please help me derive a better equation for 't'.
Time (tn) = ?; Assume tn = Tn - T(n-1); Where 'Tn' is total time to cover 'n' times 'd' units of distance.
In terms of : 'd' : is distance interval. (fixed); 'sx': initial velocity along x axis (horizotal ground); 'sy': initial velocity along y axis (against gravity 'g');
Hope, I made thing clear enough. Please let me know if you need more information.
I tried this question in 'physics.stackexchange.com', but I was thinking this might be a more appropriate place to discuss, since I want a perspective of a game developers too.