Home   Help Search Login Register  

Author Topic: Scary Maths Question  (Read 2776 times)

0 Members and 3 Guests are viewing this topic.

Unnamed

  • Guest
Scary Maths Question
« on: 26 Jun 2003, 21:32:52 »
Hi,

I wonder if anyone could be kind enough to help me with a scary maths problem?

Given a target position,  location of the firing unit and the initial muzzle velocity. How can I calculate the angle of elevation needed to hit the target?

I did try trawling through the web and other Artillery scripts, but I doubt I really know what to look for.

Thanks


Offline .pablo.

  • Former Staff
  • ****
  • When in doubt, empty the magazine.

Offline Dinger

  • Contributing Member
  • **
  • where's the ultra-theoretical mega-scripting forum
Re:Scary Maths Question
« Reply #2 on: 29 Jun 2003, 18:17:15 »
Hi unnamed:
here's how we're doing it:
range = 2-dimensional range (sqrt (x^2 + y^2))
zdiff = difference in height ASL from firing unit to target.



easy, huh?

we'll have some documentation for you when we get the system debugged.
Dinger/Cfit

Unnamed

  • Guest
Re:Scary Maths Question
« Reply #3 on: 30 Jun 2003, 00:36:35 »
Hi,

Thanks for the link pablo, and yes....my head is still hurting.

I guess I'm only half as stupid as I thought though ::) While I understand the concepts, getting it to fit my requirements is beyond me.

Yes please, looks fascinating Dinger.

I managed to cobble something together to do the job, but it's far from elegant. Plus I will be interested to see how you do the shell dispersal and stuff for some of the more extreme elevations, and a load of other questions I have :)

Thanks

Offline Dinger

  • Contributing Member
  • **
  • where's the ultra-theoretical mega-scripting forum
Re:Scary Maths Question
« Reply #4 on: 30 Jun 2003, 02:38:58 »
what that is:
we basically fired 3000 shells at the same mV, and measured a point in their trajectory corresponding to:
post-apogee and somewhere (randomly determined) between +1000 and -1000 zdifference from the firing point.
Denoir then taught that data to an Adaptive Neural Network.

As for dispersion -- right now it's just done in degrees out of the barrel in terms of deflection and elevation, following a ^2 standard deviation.  I double it for high-angle fire, because I'm lazy.
Dinger/Cfit

Offline Doolittle

  • Contributing Member
  • **
  • _this select 0
Re:Scary Maths Question
« Reply #5 on: 02 Jul 2003, 00:45:38 »
Dinger, may I ask what your projectile is?  Are you firing a barrel, a chair, a shell?  I noticed stuff "flies" differntly.  A barrel goes further than a phone and shell when given the same initial values.  I ended up just going with a barrel object.

Are you guys going to make your own object with a .cpp file?  Why not just make an object that is not affected by drag?

Unnamed, I have some stuff at http://home.earthlink.net/~dbircsak.

Doolittle

Unnamed

  • Guest
Re:Scary Maths Question
« Reply #6 on: 02 Jul 2003, 06:46:16 »
Hi,

Thanks for the link, I have a couple of questions if I can?

I think the line of script I'm interested in, is in "Artillery.sqs"?

Code: [Select]
_angle = 20

_muzzle = sqrt (4.9 * _dist / sin (2 * _angle))

If I understand it correctly. Your calculating the initial velocity (_muzzle) required to hit the target (_dist) meters away. Using a fixed elevation of 20 deg's for the gun?

So for me, if the initial velocity (_muzzle) is fixed at 260, and I already know the value for (_dist)........Theoretically I could find (_angle) for say a target 2000m away, by re-arranging this?

Code: [Select]
260 = sqrt (4.9 * 2000 / sin (2 * _angle))
Cheers

Offline Doolittle

  • Contributing Member
  • **
  • _this select 0
Re:Scary Maths Question
« Reply #7 on: 08 Jul 2003, 00:19:56 »
Yes.

But.....OFP has air drag and you will fall short.  Overshooting by some multiple doesn't work either.  Also bombs last at most 20 seconds.

I did artillery by changing angle first & having a fixed muzzle velocity, but then found it more fun to just set the angle to something.  It's no fun trying to hit something 2 feet away and having the gun fire at 89 degrees and waiting 15 seconds for the shell to fall back down.

Good luck.

Doolittle

Offline Dinger

  • Contributing Member
  • **
  • where's the ultra-theoretical mega-scripting forum
Re:Scary Maths Question
« Reply #8 on: 08 Jul 2003, 04:10:40 »
sorry doolittle -- I didn't see this until just now.
The 3d models we are firing are one based on the hellfire class (for the m26 rocket), a granat and a shell.  They are the same projectiles fired by the firing unit, and if you are hit by the projectile itself (and not, in the case of the m26, a submunition deployed by it), "deathcam" will take you to the firing unit.

Yes, High-Angle fire is boring, and mV varies according to different charges, but constant elevation is cheating ;)
Oh, and I should correct you on some detail:  The max TimeToLive of bombs is 2 minutes, not 20 seconds.
Dinger/Cfit

Unnamed

  • Guest
Re:Scary Maths Question
« Reply #9 on: 08 Jul 2003, 23:31:01 »
Quote
OFP has air drag and you will fall short.

I noticed this when comparing ranges and elevations using the standard algorithms and range testing in OFP. Plus it will overshoot at shorter ranges, and there appears to be a sweet spot (around 1400m) where both the maths and OFP match within reason.

But if drag is included in OFP what about lift? I guess it would be pretty tricky to calculate the amount of drag and lift without knowing what coefficient's BIS have used?

Quote
Are you guys going to make your own object with a .cpp file? Why not just make an object that is not affected by drag?

Can you alter an exisiting shell definition, to remove the effects of drag?

Thanks

Offline Doolittle

  • Contributing Member
  • **
  • _this select 0
Re:Scary Maths Question
« Reply #10 on: 09 Jul 2003, 00:59:55 »
I know for CERTAIN lift is not included.  Well, I would HOPE it isn't!  That would be insane!!!  Even though there is air drag...don't forget this IS just a game, not real world.  I'm sure they don't calculate the moons gravity or spin of the earth, etc.  The engine has more important stuff to do.

I say just fire 30 LGBs and don't worry about calculating precisely. :)

Doolittle

Unnamed

  • Guest
Re:Scary Maths Question
« Reply #11 on: 09 Jul 2003, 01:46:58 »
If drag is the only other factor that influences a projectile in OFP, it must be possible to work out it's effect?

Quote
I'm sure they don't calculate the moons gravity or spin of the earth, etc.

Just knowing that lift is not applied in OFP is a big help, so I had to ask. But I could not understand why a OFP round, would overshoot a shot calculated without taking drag and such like into account?

I tested the speed of a projectile as well, this remains constant. The only things that change are the velocity vetors. I thought drag works to reduce a projectiles speed?

Quote
don't forget this IS just a game

Thats what worries me kind of, I'm never sure if they have abstracted something that acts like the real world or is the real world. As the later is easier to find on the web.

If I can work out some kind of relationship that gets me close to the target, I will be happy. I'm trying to avoid carrying loads of ranging data around for every type of projectile.

Quote
I say just fire 30 LGBs and don't worry about calculating precisely.


He he, is your real name Bomber Harris? But yeah, if I did get precision artillery, I'd just go and make it inaccurate again within my script :)

Thanks
« Last Edit: 09 Jul 2003, 06:10:32 by Unnamed »

Offline Dinger

  • Contributing Member
  • **
  • where's the ultra-theoretical mega-scripting forum
Re:Scary Maths Question
« Reply #12 on: 09 Jul 2003, 09:32:50 »
heh. there is something like lift, dependant on the AOA and really messing with things.
I mean, when I was testing for UA, I found that if you fired a round at sea level out of a barrel at 75 degrees or greater elevation, the round at that AOA would achieve its maximum 2-dimensional range several hundred meters above sea level.  now plot that trajectory out and you'll see something very wrong is going on here.

If you can find the calculations to do it, good for you.  Otherwise, I recommend our neural net.  We get accuracy of <.1 m @10000 meters

Dinger/Cfit

Unnamed

  • Guest
Re:Scary Maths Question
« Reply #13 on: 10 Jul 2003, 08:32:28 »
I've started plotting the trajectories out using excel, if I can get the mass and dimensions of an OFP round. I should be able to get close.

I'm itching to see how to implement a Neural Net full stop, and in OFP aswell.

Is it available for download?

Cheers


Offline Dinger

  • Contributing Member
  • **
  • where's the ultra-theoretical mega-scripting forum
Re:Scary Maths Question
« Reply #14 on: 11 Jul 2003, 09:02:04 »
Unnamed: as far as we can tell, mass and volume don't matter for OFP's trajectories (!).
Gravity, as denoir figured out, in ofp works to 11 m/s acceleration (!).
As for the UA stuff, well, no, it's not available *yet* for download.  We have some bugs to clear up and some effects to put in.  *soon*, but not *now*.

The neural net scripts are available from www.thechainofcommand.com in the forums under "technology demos". They don't have the weights for artillery in them.  BUt again, patience -- we'll get them out soon.  (right now denoir's pissed at me because my error in calculating the difference between the center of the firing unit and the shell origin point is several times his neural net error, and people are going to think his targeting is off,).
« Last Edit: 11 Jul 2003, 09:04:46 by Dinger »
Dinger/Cfit

Unnamed

  • Guest
Re:Scary Maths Question
« Reply #15 on: 13 Jul 2003, 04:30:27 »
I wanted mass and surface area for an equation I found for calculating drag, I can get the trajectory quite close to OFP's just by adjusting some constants.

Quote
Gravity, as denoir figured out, in ofp works to 11 m/s acceleration (!).

I cant really get the timming accurate enough in OFP to say for sure, but I appear to get the closest results using 9.81 m/s ? Will keep trying until I can tell either way.

Quote
calculating the difference between the center of the firing unit and the shell origin point is several times his neural net error

Not sure what goes on between, firing and the shell appearing:

I guess the fired event picks up the shell some time after firing, rather than at creation?

And the coords appear to centre around the muzzle rather than the breach, at least for height?

They have recoile for tanks, would it affect static guns in anyway?

My problem is, I've tried to remove any random elements scripted into a OFP addon, but I'm still getting variations in the initial angle of elevation.

Cheers




Offline Dinger

  • Contributing Member
  • **
  • where's the ultra-theoretical mega-scripting forum
Re:Scary Maths Question
« Reply #16 on: 15 Jul 2003, 21:15:47 »
How are you aiming the barrel?
HAve you zeroed out the dispersion as well?
recoil shouldn't affect the round being fired.
Dinger/Cfit

Unnamed

  • Guest
Re:Scary Maths Question
« Reply #17 on: 16 Jul 2003, 02:22:36 »
I'm using the Inavasion 1944. 81mm mortar. So I have to use the DoWatch command to point to a position X meters above and to the front of the mortar, to adjust the angle of elevation.

Mortars have a minimum angle of elevation on flat ground, due to there design. But as far as the trajectory is concerned in OFP, the minimum Angle of elevation, when the round leaves the Moratr is 0. Hmm...difficult for me to explain without a picture.

Quote
Have you zeroed out the dispersion as well?

I had changed min, mid and maxRangeProbab to 1? I did not spot dispersion and aiDispersionCoefY in the cpp, so I will try changing them. Thanks.

P.S

I did download CoC_LIBANN, but it just contains a readme.txt and nothing else :(

Regards

Offline Doolittle

  • Contributing Member
  • **
  • _this select 0
Re:Scary Maths Question
« Reply #18 on: 16 Jul 2003, 17:05:30 »
Hmm...why not simplify stuff some?  I just created a shell and then "kicked" it out.  This way I knew exactly where it started from.

I really recommend firing a phone, a barrel, a shell, an AH1, and a soldier at the same initial velocities and you will see they go different ranges.  I think the barrel object behaves the best.

Doolittle

Unnamed

  • Guest
Re:Scary Maths Question
« Reply #19 on: 18 Jul 2003, 05:40:08 »
Hi Doolittle,

I started off just wanting to have some indirect fire, in a mission I was planning. I just got carried away with trying to figure out the physics behind it.

But it would be handy to know, you could apply the same principle to AA guns and bombers e.t.c.

I can predict the angle of elevation needed to hit a target with just gravity applied.

I can predict the trajectory of a projectile with gravity and drag, given the angle of elevation.

I just need to work out how to predict the angle of elevation needed to hit a target with gravity and drag applied.

Quote
I really recommend firing a phone, a barrel, a shell, an AH1, and a soldier

Lol, I think I will. Sounds like it might be fun. Pity there isnt a cow object in OFP :)

BTW thanks, I've been using your (Barrel) artillery script alot, to test my understanding of gravity in OFP.