Home   Help Search Login Register  

Author Topic: real art!  (Read 740 times)

0 Members and 3 Guests are viewing this topic.

titan

  • Guest
real art!
« on: 16 Apr 2003, 17:49:51 »
ok, heres an idea (for a VERY good scripter).

If u wanted an Art piece firing at long distances, cause shells only have 20 sec life. Cldnt u make a script that picks up the angle of the gun barrel, and the way its pointing...do some calculations and camcreate a shell at that place. so u cld have some predetermined angles...

(my basic way of scripting)

if gun barrel =45°; find direction gun barrel; distance 4000metres; camcreate etc

Offline DrStrangelove

  • Members
  • *
  • Mr.Creative
Re:real art!
« Reply #1 on: 20 Apr 2003, 10:50:49 »
What the command for finding the gun's elevation ?  :P

jamie_psx

  • Guest
Re:real art!
« Reply #2 on: 29 Apr 2003, 02:01:53 »
What the command for finding the gun's elevation ?  :P

Hah! Zat ees nussing, my slow-witted minions!  ;D

Just kidding ya. :)

Seriously, though.

If you want to find the elevation, and azimuth of the gun (or the shell it fired), this is what you can do.

Soon after the shell leaves the barrel, you take a two samples of the shell's location.

So   sample 1 = (x1,y1,z1),
and sample 2 =(x2,y2,z2).

Regardless of whether projectiles in OFP follow a semi-circular, parabolic, or other type of trajectory, if you take the two sample pretty close to each other, then the path between them approximates to straight line.  
Which is what you need for elevation.

STEP 1:
To make life easier for yourself, do a transfer of coordinates, so that Sample 1 is your origin (0,0,0), and Sample 2 becomes
(x2-x1,y2-y1,z2-z1). So just call Sample 2 values as (X,Y,Z).

STEP 2:
To find the gun's Azimuth do the ArcTan (or Tan Inverse) of the ratio (X/Y).  That is Azimuth=Arctan(X/Y).
Be sure not to confuse degrees with radians.
I believe OFP accepts degrees, so your Azimuth answer should be in degrees.

STEP 3:
Define a value R=[(X^2)+(Y^2)+(Z^2)]^(0.5).
That is the square root of the sum of the squares of X,Y, and Z.
GUN ELEVATION = ArcSine(Z/R)=Elevation Angle.
Again don't confuse degrees with radians.

STEP 4:
There's probably an easier way to do this with Vector Algebra, but I'm too lazy to look it up.

Someone please correct me if I've made a mistake.
Ain't math sweet.  ;D

Offline Dinger

  • Contributing Member
  • **
  • where's the ultra-theoretical mega-scripting forum
Re:real art!
« Reply #3 on: 29 Apr 2003, 06:13:26 »
Well, the problem is you've got to adjust your solution for the fact that the Z value of the terrain (AGL instead of ASL).
alternatively, you can just read the vector and calculate it off of that.
_velocity = velocity _MyShell

_vectorx = _velocity select 0
_vectory = _velocity select 1
_vectorz = _velocity select 2

_Velocity2d = sqrt (_vectorx^2 + _vectory^2)
?_vectory == 0:_azimuth = 90 * (_vectorx/(abs _vectorx)):goto "Skipazatan"
_azimuth = atan (_vectorX/_vectory)
#Skipazatan
?_velocity2d = 0:_elevation = 90 * (_vectorz/(abs _vectorz)):goto "Skipelatan"
_elevation = atan (_vectorz/_distance2d)
#Skipeleatan

Anyway, look for an update this week on jostapo and my "CoC Unified Artillery" project.  We have, I believe, solved all the major problems associated with indirect fire in OFP.  Right now in tests, a player in an MP came can call up a platoon of M109s in Modrava (19m ASL), order them to fire a fire mission consisting of say a 3-round converged sheaf (HA) on the fountain in Lipany (range: 11,485m -- 130m ASL).  The platoon lines up, elevates the barrels to the appropriate setting (as determined by a tabular firing table), and fires for effect.  If we turn off precision and bias error (read: dispersion), all 12 shells land within 3m of the fountain.
Dinger/Cfit

Kinnon

  • Guest
Re:real art!
« Reply #4 on: 29 Apr 2003, 18:01:36 »
I WANT !

What's up with the CoC forum :(

Offline Dinger

  • Contributing Member
  • **
  • where's the ultra-theoretical mega-scripting forum
Re:real art!
« Reply #5 on: 29 Apr 2003, 22:14:34 »
an Ikonboard (or was it UBB. I dunno) "autoupdate" crashed the darn thing.  It's up now but walker's having to restore files by hand, so there's nothing to see for a few more days.
As for artillery, we've got a few weeks of testing and tweaking ahead of us.
« Last Edit: 29 Apr 2003, 23:41:19 by Dinger »
Dinger/Cfit