- #1
TheShermanTanker
- 13
- 4
Hi, I know I've asked this before but I didn't manage to solve the problem before. To give context I'm trying to find the angle to hit a target with given coordinates from my current location in a particular game. (I'm modding the game) I can do it with zero problems when not including air resistance, but the frustrating as hell thing is that solutions with air resistance are rare to come by online. It turns out the most promising solution I came across recently by desmos required the target be the same height at you (Ie both you and target have to be at the same y coordinate. Y is the up and down coordinate in this particular game's physics engine btw), and if you are above the target or below it wouldn't work. Would be great if i could get some help here :)
If it helps, here's how the physics engine models the projectiles:
Gravity: 20m/s2 (Easily solved)
Air resistance: Take the x, y, and z velocities of the projectile and multiply it by 99% 20 times every second. Ie:
Following code is run 20 times every second:
proj.motX = proj.motX * 0.99;
proj.motY = proj.motY * 0.99;
proj.motZ = proj.motZ * 0.99;
The physics engine fortunately does not calculate the surface area, mass or kinematic viscosity of air, phew XD
If it helps, here's how the physics engine models the projectiles:
Gravity: 20m/s2 (Easily solved)
Air resistance: Take the x, y, and z velocities of the projectile and multiply it by 99% 20 times every second. Ie:
Following code is run 20 times every second:
proj.motX = proj.motX * 0.99;
proj.motY = proj.motY * 0.99;
proj.motZ = proj.motZ * 0.99;
The physics engine fortunately does not calculate the surface area, mass or kinematic viscosity of air, phew XD