I’m just reaching out because I’m having a bit of a trouble trying to get the wind and projectile compensation working properly. In games such as “Tanks” there is a wind gauge which affects how projectiles will move, either helping and increasing the force on them, or reducing the force and distance, even so much to have the trajectory change and return towards the player. I am looking for a solution for this, however, I am off base here somewhere and seeing if anyone can point me in the right direction, or has a solution for it. There doesn’t seem to be any information on this out there at this time.
So, I’ll explain the controls so the code makes sense first. The aiming is done to cursor location. Holding LMB increases the power to a max of 100. Releasing launches. This is then multiplied by a static variable to increase the velocity of the projectile. Projectile Direction is based on the Left/Right Direction of the player at time of shooting. Half power is a number which is half of the max power the player put out where I determine that wind should start having an affect to give the projectile some time to fly first.
This Custom Event is run on a timer, which is fast enough to adjust the velocity as needed. The reduction for the gravity is to ease the drop.
One problem with this is that I do not get a nice curve as it goes along. Instead, once it reaches half it’s power, it drops a lot faster it seems.
The other issue is that on strong winds in the opposite direction it does return to the player a bit, but again, it’s not a smooth curve, and it almost b-lines for the player every time.
This is the simple wind calculation that changes over time, once the power is less than half.
From your Blueprint I can see you are trying to create a ‘good feel’ rather than realistic ballistic parabolic flight.
You have a few ‘magic numbers’ that you could promote to parameters to make it easier for you to tweak the behaviour to get the feel you are after:
Linear/Curve power cut-off - currently 0.5
Gravity Reduction Factor - currently 3.0
Wind Resistance - currently X -1.0 (too high?)
Once you promote these numbers to parameters you can play-test and tweak. If it was me, I would also use Draw Debug Sphere in the Apply Wind event to plot the path of my bombs, then I would use the Debug Camera (semi-colon shortcut on the keyboard during play-testing) so I can fly around and have a look at the path recorded - a nice way of visualizing the paths. If I shot multiple times with different tweaked parameters, I could compare the paths as Draw Debug Sphere can leave the plot in place if I leave the duration at 0 (infinite).
Hello, and thanks for the reply. It’s kind of a 2 part thing. Yes, I am looking for a good feel, but I am also looking for something that has a good arc in it’s path. Gravity can account for the main arc, but when wind is applied it doesn’t look good at all. What I am hoping someone can help with is a better way to calculate the wind force against the current velocity of the projectile to help give it a more believable arc and influence.
The wind resistance set to 1 is the most extreme value I would use, which is why I was using it for testing purposes. This value will change over time ranging from -1 to 1. The gravity change is because at gravity’s current influence + the wind’s influence the rate of drop does not match the rate of flight pre-drop.
I have done debugs a lot and these values are more just arbitrary at this time, as I know the calculation method is the cause more than the numbers themselves.
Anyone have some sort of calculation for this they wish to share? I am just trying to create a similar 2d kind of wind/projectile structure to that of Worms Armageddon. Thanks