-1

I need the 3D trajectory of a rocket (variables: starting position, landing position, maximum altitude, flight angle):

demonstration

In Lua on MultiTheftAuto GTA SA I want to calculate this trajectory. I need a set of points to change the Y coordinate (height). I have X and Z. I have a loop that every meter of the trajectory goes through and need to get Y based on these variables.

user4157124
  • 2,809
  • 13
  • 27
  • 42
  • If you want it mathematically you might extend on `angle`. It seems like you have a starting angle and a change of angle? – Luke100000 Oct 12 '22 at 13:34
  • If precision is not important, and you just want a fancy trajectory, I suggest something like `y = sin(x * pi) ^ shape * height`, where `x` is the distance traveled, normalized to 0 to 1, shape has an influence of the trajectory, around 1.5 looks good for your case. It does not keep a steady max altitude tho. – Luke100000 Oct 12 '22 at 13:37
  • @Luke100000 Thanks for the possible solution! I will definitely check your method. I was sure that at least middle level mathematics (sines, cosines, etc.) would be needed here, but I'm not particularly strong in this area. – John Mayot Oct 12 '22 at 13:55
  • @Luke100000 https://imgur.com/a/55SRiOI - the result of your function. This is what I need. I have specified the following parameters: `sin(normalizedX * pi) ^ 0.6` – John Mayot Oct 12 '22 at 16:08
  • "or otherwise"? There is no otherwise. Better learn a little about physics. The first chapter of any physics text about Newtonian mechanics should be enough. You have to integrate nine equations simultaneously: three for accelerations, three for velocities, and three for displacements/positions. – duffymo Oct 12 '22 at 17:15
  • @duffymoI will definitely study. At school it was not as interesting as it turned out in life! – John Mayot Oct 12 '22 at 18:55
  • Does this answer your question? [How to calculate rocket?](https://stackoverflow.com/questions/53978393/how-to-calculate-rocket) – Spektre Oct 13 '22 at 06:19
  • see the duplicate [How to calculate rocket?](https://stackoverflow.com/questions/53978393/how-to-calculate-rocket) on how its done – Spektre Oct 13 '22 at 06:20
  • @Spektre I needed a simple flight path, without any rubbish like gravity, etc. But in theory, this could be the answer. Thank you, but it's too late) – John Mayot Oct 15 '22 at 16:20

1 Answers1

-1
// float x = 0.0 - 1.0

y = sin(x * pi) ^ 0.6
  • 2
    this does not match your problem (shape of trajectory is different and you missing a lot of tweakables to ensure rocket hits the target) you stated and also without any description will be of no help to others ... I am missing a lot of stuff for the rocket like target position, actual speed , dynamics constants etc ... – Spektre Oct 13 '22 at 06:22
  • Luke100000: *just a fancy trajectory*. Fun starts with landing higher or lower than start, non-constant wind. Do *not* learn war! – greybeard Oct 13 '22 at 07:35
  • Look at your graph. I'm guessing this shows velocity versus time. You have an acceleration phase, a deceleration phase, a long zero acceleration phase at constant velocity, followed by deceleration and landing. This is a simple problem if you just knew the physics. – duffymo Oct 13 '22 at 13:00
  • @greybeard I solved all the problems that you described on my own, and this was not a problem for me (I did not write in the topic). In response to my topic, I wrote what helped me, and in my opinion this is logical. – John Mayot Oct 15 '22 at 16:16