I’m on a journey for days, and this may be my last attempt to solve it. First, I wanted to let you know that this is my first post in the community, so if I’ve got something wrong, please let me know.
I also searched for an answer here, and all I could find were other methods, using invisible objects in a way I’d like to avoid if possible.
I’m trying to develop a formula that allows me to move one or more projectiles, from the player, where the curvature angle value can be defined (examples: 0, -20°, 180°) and the time it stays alive in the scene is also predefined (examples: 500ms, 2000ms), however, the final distance it reaches must always be the same, regardless of the previous variables.
In this case, a gain in velocity would be necessary to compensate for the curvature of the projectile (in case of angle 0, I believe it would not be necessary)
It’s also relevant to me that the sync is with time, so I’m trying to multiply the parameters by a timer, instead of letting them add up frame by frame.
What I came closest to here, with a lot of trial and error and a few requests to GPT Chat for help, is what can be seen in the screenshots.
- “definir como” is “define as” or “=”
If the spin angle applied per second is 360 it dies at something close to twice the distance, if it is 360/256 (i.e. 1.40625 degrees) the projectile dies at the right time (but it’s such a small number, that maybe any Something close would give a similar result). Even so, it seems that there is a logic there, just missing “the final adjustment”. Just for reference the total time of this test circle is 6.4 seconds and the initial offset is 12.5 px per second. “tCircleLife” is a timer that activates with the start of the event and dies when it ends.
TL;DR
((Variable(vCircleFinalDistance)/Variable(vCircleLifeTime)*tan(ToRad(Variable(vCircleAngleAdctiveCompound)))))
What do I need to do in this formula, so that this acceleration addition variable compensates for the “loss of distance” caused by the object’s angulation? (Compared to an object in a straight line with the same speed and created at the same time)
Since the result of this formula will be multiplied by a timer and added to the original speed of the projectile moved by force.
I thank everyone’s attention