Hello everyone,I am trying to create an archery system in GDevelop using the Physics.2 behavior to achieve a ballistic trajectory for the arrow. Specifically, I want the arrow to start at -45 degrees towards the upper-right and follow a parabolic path to hit a target. The distance between the archer and the target changes, so the speed with which I shoot the arrow needs to adjust based on the distance.
I’ve done some experiments, but nothing is working quite right:
When I manage to make the arrow start at -45 degrees, it doesn’t hit the target. It continues at the same -45-degree angle, only influenced by gravity.
If I manage to hit the target, the arrow does not start at -45 degrees as intended.
Has anyone encountered a similar issue and found a solution? Any suggestions would be greatly appreciated!
A diagram/screen shot would be good here. Is there a reason it needs to start at -45 degrees? As a rule of thumb, if gravity stay s constant then you either change trajectory angle or velocity.
I’m trying to achieve a type of shot like the one shown in the example. Since the knight (or target) is moving, I assume that the values need to be recalculated with each shot. The arrow uses three variables “TargetAngle”, “TargetDistance”, and “Force” which should determine the direction and strength of the shot.
I believe I’ve set up the formulas for the calculations correctly, but I can’t figure out how to properly integrate them into the Physics2 behavior. The main issue is that I’m not sure in which order the calculations should be executed, and in which fields of the behavior the resulting values should be inserted.
To simplify the situation, I created a clean scene: the blue dot represents the archer, while the yellow one , linked to the mouse movement , simulates a moving enemy, with coordinates that vary within the archer’s range.