|
-
hi
well an idea woudl be doing it like the binary search (guessing ) system does it.
1. let the tank shoot with some power and some angle
2. measure the distance to the target
3. figure out if you shot in front of the target or behind
4. increase/decrease power/anlge by some value
5. see point 1.
but i think this is only necessary when doing real high complex calculations WITHOUT knowing the influences of the environment to the projectile (wind,...) - yours is not that complex plus you know the exact position of the target. Just calculate the optimal shot using standard physics formula calculating a projectiles flight and reverse it. you "know" already where the bomb will fly to, what you want to know is how it flys there Well you might say then "okay, but there are 2 variables - angle AND power". Well, as u said: limit the calculation to find the necessary power for every angle until it hits. there are only 45 (or 90 if u use 0.5 angles too) different angles to work with, that should be no problem for any pc being pentium class.
So create a loop that increases both (power and angle) until it hits the target or shoots too far - when shot was too far keep angle but modify power.
Yours
HTD
BTW the angles needed are only "45 to 90" starting from the ground. u can also use 0 to 90 but i think this is unnecessary.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|