Jump to content
Sign in to follow this  
major woody

Finding some parameters

Recommended Posts

I'm trying to find some parameters from the static howitzers. In order to do so I use som various scripts.

Howitzer initfield

Quote[/b] ] cannon1 addaction ["Find angle","angle.sqs"]; cannon1 addaction ["Fire","fire.sqs"]

angle.sqs

Quote[/b] ]cannon1 DoWatch [GetPos object1 Select 0,GetPos object1 Select 1,90] <--- the angle

This puts the howitzer in an angle around 90dg. (Or at least at maximum elevation)

fire.sqs

Quote[/b] ]

cannon1 fire (weapons cannon1 select 0)

this addEventHandler ["fired",{[(nearestObject [_this select 0,_this select 4])] exec "bulletdis.sqs"}]

exit

bulletdis.sqs

Quote[/b] ]

_shooter = _this select 0

_ammo = _this select 4

_log = "logic" camcreate getpos _shooter

_bullet = nearestObject[_cannon1,30Rnd_122mmHE_D30]

_dis = 0

#loop

?isnull _bullet :goto "end"

_dis = _bullet distance _log

@true

goto "loop"

#end

player hint format ["You've fired %1m far",_dis]

deletevehicle _log

exit

The bulletdis.sqs was supposed to give me the distance from the howitzer to the impact, but all I got is an error message like this

Quote[/b] ]

'_bullet = |#|nearestObject[cannon1,30nd_122mmHE_D30]'

Error nearstObject: Type Number, expected Array

Any help/suggestions would be fine  confused_o.gif

Share this post


Link to post
Share on other sites

Make up your mind wether or not you want to pass all the parameters from the fired EH to the script or just the projectile:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this addEventHandler ["fired",{[(nearestObject [_this select 0,_this select 4])] exec "bulletdis.sqs"}]

This passes ONLY the projectile on to bulletdis.sqs, where in order to function the bulletdis script requires the following setup:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this addEventHandler ["fired",{_this exec "bulletdis.sqs"}]

Since bulletdis.sqs is looking for an array of at least 5 values, and [(nearestobject [_this select 0,_this select 4])] is only 1 value. People tend to forget that addEventHandler is NOT the same as addAction, which automatically passes all it's parameters on to the script (which must be a script and not code), whereas addEventHandler uses code and the script must be called manually with the parameter _this to pass on the EH parameters. Think of the stuff inside the { } as an init field (or trigger On Activation field which is a more appropriate analogy), and the variable _this is equal to [shooter,weapon,mode,muzzle,ammo] (or whatever the correct order is, I always forget).

Share this post


Link to post
Share on other sites

Your better sticking with this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this addEventHandler ["fired",{[(nearestObject [_this select 0,_this select 4])] exec "bulletdis.sqs"}]

I's a more reliable way of getting the round.

But put the above line in the units init field or add it via init.sqs. Don't keep adding it every time you execute fire.sqs, otherwise you will be running multiple versions of the same script. Ok perhaps your just setting up a quick test? but thought I should mention it.

Both methods will work most of the time. But sticking with your original code, all you would then need to change is this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_shooter = _this select 0

_bullet = _this select 1

_dis = 0

#loop

?isnull _bullet :goto "end"

_dis = _bullet distance _shooter

@true

goto "loop"

#end

player hint format ["You've fired %1m far",_dis]

exit

Share this post


Link to post
Share on other sites
Your better sticking with this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this addEventHandler ["fired",{[(nearestObject [_this select 0,_this select 4])] exec "bulletdis.sqs"}]

I's a more reliable way of getting the round.

But put the above line in the units init field or add it via init.sqs. Don't keep adding it every time you execute fire.sqs, otherwise you will be running multiple versions of the same script. Ok perhaps your just setting up a quick test? but thought I should mention it.

Both methods will work most of the time. But sticking with your original code, all you would then need to change is this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_shooter = _this select 0

_bullet = _this select 1

_dis = 0

#loop

?isnull _bullet :goto "end"

_dis = _bullet distance _shooter

@true

goto "loop"

#end

player hint format ["You've fired %1m far",_dis]

exit

You're still forgetting the first parameter UNN, so you need:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this addEventHandler ["fired",{[_this select 0,(nearestObject [_this select 0,_this select 4])] exec "bulletdis.sqs"}]

Second, if you are using SQF then it would make no difference where you find the bullet, and it would be a lot neater to put that part in the script and just pass on all the parameters, cause even if you don't use them it won't matter if you pass them on, you don't have to define them in your script. Then if you ever needed them you could just define them in the script and use them without having to change your EH.

The most effecient way to do this (or at least a far more effecient way than any of the above) is like so:

Init:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">BulletDis = compile loadfile "bulletdis.sqf"; this addeventhandler ["fired",{hint format ["%1",_this call BulletDis]}]

bulletdis.sqf:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">private ["_shooter","_ammo","_bullet","_dis"];

_shooter = _this select 0;

_ammo = _this select 4;

_bullet = nearestObject[_shooter,_ammo];

while{alive _bullet}do{

_dis = _bullet distance _shooter;

sleep 0.001;

};

_dis

Share this post


Link to post
Share on other sites

Let me get this straight:

Still in the initfield:

Quote[/b] ]

cannon1 addaction ["Find angle","angle.sqs"]; cannon1 addaction ["Fire","fire.sqs"]

angle.sqs still the same

Quote[/b] ]

cannon1 DoWatch [GetPos object1 Select 0,GetPos object1 Select 1,90] <--- the angle

The new fire.sqs

Quote[/b] ]

cannon1 fire (weapons cannon1 select 0)

this addEventHandler ["fired",{[_this select 0,(nearestObject [_this select 0,_this select 4])] exec "bulletdis.sqs"}]

exit

The new bulletdis.sqs

Quote[/b] ]

;_shooter = _this select 0

_bullet = _this select 1

_dis = 0

#loop

?isnull _bullet :goto "end"

_dis = _bullet distance _shooter

@true

goto "loop"

#end

player hint format ["You've fired %1m far",_dis]

exit

The init

Quote[/b] ]

BulletDis = compile loadfile "bulletdis.sqf"; this addeventhandler ["fired",{hint format ["%1",_this call BulletDis]}]

Bullet.sqf

Quote[/b] ]

private ["_shooter","_ammo","_bullet","_dis"];

_shooter = _this select 0;

_ammo = _this select 4;

_bullet = nearestObject[_shooter,_ammo];

while{alive _bullet}do{

_dis = _bullet distance _shooter;

sleep 0.001;

};

_dis

If I got right and done what I supposed to do it still leaves me an error:

Quote[/b] ]

'player |#| hint format [you have fired %1m far ,_dis...

_dis = _bullet distance _shooter;

|#|sleep 0.001;

};

_dis

'

Error Mission ;

HOWEVER it still gives me a distance I guess: 2.28273 (How manny meters is this supposed to be ) crazy_o.gif

Share this post


Link to post
Share on other sites

First, you should get rid of the EH from the Fire.sqs, you only need to add an EH once (in the init). And the bulletdis.sqf replaces the bulletdis.sqs, you only need the former with the new EH. Second, the error you're getting is from the line "player hint format....". This is invalid because the hint command does not require a parameter in front of it because nobody is doing the hinting. That 'player' before the hint command should be removed for it to work, but like I said that's from the bulletdis.sqs that you don't even need anymore (not with the .sqf). Third, that distance is in meters, but since when a shell impacts it is instantly deleted you can't find it's position/distance from firer at the exact moment it hits, but you have to take it in increments until it impacts, and use the last known position/distance before it was destroyed, thus the more times you find the distance the more accurate it is, and this of course depends on how much time it takes for the shell to travel (the faster it is the harder it is to get accurate results) it's trajectory, and if it's too fast for the script/function to keep up with you'll only get 1 or 2 distance checks before it impacts and they're going to be closer to the cannon than the impact position, so you might want to keep making the time in the sleep command smaller and smaller until you get accurate enough results. You're probably not going to get very accurate distances with direct fire, since the shell travels way too fast. Any projectile that takes under half a second or so to impact is going to be impossible to get precise distances for, sorry.

Share this post


Link to post
Share on other sites

Now I put in an additional null in the script

Quote[/b] ]

private ["_shooter","_ammo","_bullet","_dis"];

_shooter = _this select 0;

_ammo = _this select 4;

_bullet = nearestObject[_shooter,_ammo];

while{alive _bullet}do{

_dis = _bullet distance _shooter;

sleep 0.0001;<---

};

_dis

-so now I'm outta errors!

But let me get this straight once again:

whit an angle of 45dg I get a distance saying 1.84952.

- does that mean I shoot approx 8495.2 meters whith that angle?

confused_o.gif

Share this post


Link to post
Share on other sites
Quote[/b] ]I'm trying to find some parameters from the static howitzers

I see you gonna find distance(angle) function. It's possible and I used to do it for OFP. With that info you can order gun actually fire at the given target kms away... on the flat ground smile_o.gif But how are you going to get height correction ? wink_o.gif

Share this post


Link to post
Share on other sites
Quote[/b] ]You're still forgetting the first parameter UNN

Yeah, sorry. I just used cut and paste without reading it properly.

Quote[/b] ]Second, if you are using SQF then it would make no difference where you find the bullet, and it would be a lot neater to put that part in the script and just pass on all the parameters, cause even if you don't use them it won't matter if you pass them on, you don't have to define them in your script. Then if you ever needed them you could just define them in the script and use them without having to change your EH.

The most effecient way to do this (or at least a far more effecient way than any of the above) is like so:

Well call it tradition or superstition, I prefer to avoid the call command for that kind of loop. Especially as we were working with the old syntax. As you say the relevant parameters can be obtained either way. But even with the new syntax, I would be happier getting them in the init field and use execVM or Spawn for the loop.

So my slight variation would be:

Init.sqs:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">GetFired=Compile "[_This Select 0,nearestObject [_this select 0,_this select 4]] ExecVM "BuilletDist.sqf";

Init field:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this addEventHandler ["fired",_This Call GetFired]

I do think calling just the two commands execVM and nearestObject in one line is worth the compile. But that’s all speculation at this point and perhaps I'm getting a little off topic.

Quote[/b] ]But let me get this straight once again:

whit an angle of 45dg I get a distance saying 1.84952.

- does that mean I shoot approx 8495.2 meters whith that angle?

No 1.84952 equals 1.84952 meters. Something’s going wrong, I suspect it's the while loop reaching it's maximum count, 1.86 seconds into the rounds flight. To confirm it, increase the sleep value to 0.01. You should see an increase in _dist, if that’s the case.

I did exactly the same mission when I was testing a config for extend ammo ranges, but I can't find it now. If you still have no luck, I can knock up the mission again and post it with a config to increase the range of the M119.

Share this post


Link to post
Share on other sites

did some tests a few week back myself, d30 ran out of steam and destructed about 4440 ( one time 4600) and sabot about 5700.

the parabolic trajectory of the d30 i not good for much altho there is some. i guess the best thing to test is with the bullet dis sqs with event handler ks rectified and add a camera

at 90 degrees you will probably hit land in about 4000 meters

to clarify it would be

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this addEventHandler ["fired",{[_this select 0,(nearestObject [_this select 0,_this select 4])] exec "bulletdis.sqs"}]

where bulletdis sqs =

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_shooter = _this select 0

_Missile = _this select 1

_cam = "camera" camcreate [2944.96,102689.66,23.15]

_cam cameraeffect ["internal", "back"]

_cam camsettarget _Missile

_dis = 0

_spud = velocity _missile

#loop

_x = (getpos _missile select 0)

_y = (getpos _missile select 1)

_z = (getpos _missile select 2)

?isnull _Missile :goto "end"

_spud = velocity _missile

_dis = _Missile distance _shooter

titletext [format ["the bullet is %1m from you traveling at %2 ",_dis,_spud], "plain", 1]

_cam camsetpos [_x+2,_y-8,_z]

_cam camsettarget _Missile

_cam camcommit 0

@true

goto "loop"

#end

_cam cameraeffect ["terminate", "back"]; camdestroy _cam

exit

you could also add a final hinformat od _dis = _missile distance object1

edit . obiously _spud will be shown as an array of x_y_z of the velocity, not sure if object speed works here anymore

Share this post


Link to post
Share on other sites

EXACTLLY what I needed deanosbeano - but at the highest angles the shell does'nt seem to impact but rather terminate in the air sad_o.gif

That kinda narrows down how far you wanna shoot whith the guns  sad_o.gif  - or...?

Share this post


Link to post
Share on other sites
Quote[/b] ]That kinda narrows down how far you wanna shoot whith the guns

You can increase the timeToLive value for your ammo if you want to extend the ranges.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class CfgPatches

       {

       class MYM119 {

               units[] = {"MYM119"};

               weapons[] = {"MYM119"};

               requiredVersion = 0.1;

               requiredAddons[] = {};

               };

       };

class CfgAmmo

       {

       class Sh_105_HE;

       class MySh_105_HE : Sh_105_HE

               {

               timeToLive = 120;

               };

       };

class CfgMagazines

       {

       class 30Rnd_105mmHE_M119;

       class My30Rnd_105mmHE_M119 : 30Rnd_105mmHE_M119

               {

               displayName = "MySh_105_HE";

               ammo = "MySh_105_HE";

               };

       };

class cfgWeapons

       {

       class M119;        

       class MYM119 : M119

               {

               displayName = "MYM119";

               magazines[] = {"My30Rnd_105mmHE_M119"};

               };

       };

class cfgVehicles

       {

      class StaticWeapon;

      class M119 : StaticWeapon  

               {

               class Turrets

                               {

                               class MainTurret;

                               };

               };

       class MYM119 : M119

               {

               displayName = "My M119";

               class Turrets : Turrets

                       {

                       class MainTurret : MainTurret

                               {

                               weapons[] = {MYM119};

                               magazines[] = {"My30Rnd_105mmHE_M119"};

                               };

                       };

               };

       };

Share this post


Link to post
Share on other sites
Quote[/b] ]

but at the highest angles the shell does'nt seem to impact but rather terminate in the air

yup they have time tolive like unn says, depends how complicated you wanna go, but i guess at this stage you can go 2 or 3 ways.

one would be the way unn sugestsed above and create custom config addon .

or you could script some custom velocity sqs which is ok for small finite scenarios.

or you could mess with vectorup and velocity and make a big old

matrix.

all available on wiki and in these forums. big project but very much needed, unless 505 gonna give us more ?

What i woiuld like to add is that it would be good if the shell from this d30 cannon had a ttrajectory like the ,grenade launcher but on a bigger scale ,so you could shoot over mountains and hills.

I dont know about real life d30 maybe the ballisitc is lifelike already ,so maybe a diiferent cannon and shell is needed

Share this post


Link to post
Share on other sites
Quote[/b] ]What i woiuld like to add is that it would be good if the shell from this d30 cannon had a ttrajectory like the ,grenade launcher but on a bigger scale ,so you could shoot over mountains and hills.

The problem Dinger identified with extended trajectories in OFP is still there, the shell actually starts to fly backwards sad_o.gif

I came up with a pretty good match for OFP's trajectories using a ballistics equation I got off the net. But that falls apart over long ranges, for the above reasons.

I think you may have to wait for CoC's UA in Arma. A Nueral Network is the only thing that can make any sense out of the BIS trajectories.

Edit:

You could script every aspect of the projectile, but that would be a heavy script running for every round fired. Then there is the question of the model you use. Using a real ballistics formula means you have a hard time predicting the impact point and ETA. You could use standard parabolas, but thats note very realistic.

Share this post


Link to post
Share on other sites

Got some whole new ideas now. Since I'm new to config making -and scripting in ArmA (and ofp as well  wink_o.gif ) I hope you would'nt mind post the rest of the config sample.

Actualy from the beginning I was hoping to release a full addon instead of just the scripting

-so this comes in very handy.  smile_o.gif

Share this post


Link to post
Share on other sites
Quote[/b] ]Since I'm new to config making -and scripting in ArmA (and ofp as well   ) I hope you would'nt mind post the rest of the config sample.

That’s all there is for that config. It was created solely to test the TimeToLive parameter, it just adds a new M119 with a new weapon and ammo.

Quote[/b] ]the shell actually starts to fly backwards

Yeah, that’s what I thought when Dinger first mentioned it. But add a 2D distance check in a loop between the round fired and the gun, you eventually see the distance between the two start to decrease. I think it only happens with elevations greater than 45 degrees over an extended period of time.

Another quirk that’s passed over from OFP is the shell does to alter it's angle of attack. It remains at it's initial firing angle for the entire flight.

Share this post


Link to post
Share on other sites
Quote[/b] ]But add a 2D distance check in a loop between the round fired and the gun, you eventually see the distance between the two start to decrease

Never seen anything like this. Note that sqs loops are a bit buggy in ofp and you need to some tricks to get actual trajectory. Anyway making real UA style artillery needs approximation a lot of data from the game. I for ex. won't do anything like this by hand - so we need smth like ofpext or fwatch to get the data ib txt file. After you can use Nueral Network or any method you like to process this data.

Quote[/b] ]I think you may have to wait for CoC's UA in Arma

AFAIK UA worked for artillery in VBS1 , doen't they ? Thus they can have some source code available about trajectories in OFP.

Share this post


Link to post
Share on other sites

Things are going very well ATM. Something is bothering me however. In the config I try to define the VehicleClass like in OFP

Quote[/b] ]

class cfgVehicles

      {

     class StaticWeapon;

     class D30 : StaticWeapon  

              {

              class Turrets

                              {

                              class MainTurret;

                              };

              };

      class 2A18 : D30

              {

              vehicleClass=Artillery;<----------

              displayName = "2A18";

but it's not quite satisfied whit that - it gives me this error:

Quote[/b] ]

No entry 'bin\config.bin/CfgVehicleClass.Artillery'.

Does'nt ArmA support custum VehicleClasses or do I have to do it in an other way?  smile_o.gif

-oh, and by the way! In RL the maximum elevation angle of the D30 is +70dg - is that the same in ArmA?

Share this post


Link to post
Share on other sites
In the config I try to define the VehicleClass like in OFP

You have to define cfgVehicleClasses first wink_o.gif

Share this post


Link to post
Share on other sites
Quote[/b] ]Does'nt ArmA support custum VehicleClasses or do I have to do it in an other way?

Yeah, but it should be a string:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">vehicleClass="Artillery";

Quote[/b] ]Never seen anything like this.

Shells in OFP never lasted long enough for it to show up. CoC used the laser guided bomb class, as a round. That had a longer life span.

Quote[/b] ]Note that sqs loops are a bit buggy in ofp and you need to some tricks to get actual trajectory.

Really? They always work quite well for me. But getting the 2D distance between two objects is basic stuff.

Quote[/b] ]I for ex. won't do anything like this by hand - so we need smth like ofpext or fwatch to get the data ib txt file. After you can use Neural Network or any method you like to process this data.

The quickest way I found was to write it out to a dialog control. Then you can just cut and paste it. But there was never any examples on how to train the network, so I don't think anyone ever used it for anything else?

Quote[/b] ]AFAIK UA worked for artillery in VBS1 , doen't they ? Thus they can have some source code available  about trajectories in OFP.

I dunno, but their Neural Network did a good enough job on its own.

Share this post


Link to post
Share on other sites

I know in basics how UA worked in OFP. But I know almost nothing about neural networkso I used another method of approximation. I used to explore laser guided bomb class (shell only lives 20 sec) and I never seen it to fly back.

I could easily find distance(angle) function and hit any object on the _flat_ ground, but i can't manage to take account of height difference.

Quote[/b] ]The quickest way I found was to write it out to a dialog control. Then you can just cut and paste it.

Seems to be a good idea... Can you post an example ? I used ofpext (russian fwatch ) to wright data right into the external txt file.

Quote[/b] ]Note that sqs loops are a bit buggy in ofp and you need to some tricks to get actual trajectory.

Really?

Quote[/b] ]Note that sqs loops are a bit buggy in ofp and you need to some tricks to get actual trajectory.

Really?

Example:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#loop

_dist = [_initPos,getpos _Missile] call dist2D

player sidechat format ["%1",_dist,_time] //or any data print

~.01

?!(isNull _Missile):goto "loop"

player sidechat format ["%1",_time]

This code will give you incorrect data. With wierd trajectory and even and _time for shell won't be even about 20 smile_o.gif

That's due to tracing delay (engine needs time to execute a line in OFP scripts). Don't know how it's in AA at the moment

Correct code is smth like:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_hack = _time

#loop

_dist = [_initPos,getpos _Missile] call dist2D

~.01 - (_time - _hack)

_hack = _time

?!(isNull _Missile):goto "loop"

player sidechat format ["%1",_time]

Share this post


Link to post
Share on other sites
Quote[/b] ]could easily find distance(angle) function and hit any object on the _flat_ ground, but i can't manage to take account of height difference.

If your using the method of sampling different ranges according to angle of elevation, then storing them in an array? Then yeah, it only works with level targets. You could sample data for different heights as well, but that just creates to much information to handle.

Quote[/b] ]This code will give you incorrect data. With wierd trajectory and even and _time for shell won't be even about 20

I've seen the weird trajectory, it's what I mentioned before about the distance starting to decrease at a certain point instead of constantly increasing.

Quote[/b] ]That's due to tracing delay (engine needs time to execute a line in OFP scripts).

Thats not really a bug, OFP was designed that way. This should give you more accurate time slices:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">@(Call {player sidechat format ["%1",[_initPos,getpos _Missile] call dist2D ,Time]; !(isNull  _Missile)})

Although the above example samples at 0.001 second intervals.

But you could also use SetAccTime below 0 to help compensate for any delay.

Quote[/b] ]But I know almost nothing about neural networks

Same here, but it's a shame it didn't come with any documentation. As I think it could have been used for loads of stuff.

Share this post


Link to post
Share on other sites

sorry for delay - networks problems. sad_o.gif

Quote[/b] ]If your using the method of sampling different ranges according to angle of elevation, then storing them in an array?

nope. I got the data then process it with MathCad and got the function angle(distance) - it's polynominal.

As a result i could find the angle i need with the following code

.<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">private ["_d","_ang","_i","_k"];

_d = _this select 0; //distance

// koefs found with mathcad for the specific gun

_k0=-0.4349;

_k1=5.1257e-3;

_k2=-2.8544e-7;

_k3=6.3696e-11;

_k4=6.7414e-15;

_k = [_k0,_k1,_k2,_k3,_k4];

_ang = 0;

_i = 0;

while {_i < (count _k)} do

{

_ang = _ang + (_k select _i)*(_d^_i);

_i = _i + 1;

};

//hint format ["dist %1 \n angle %2",_d,_ang];

_ang

But I got no idea how to get into accout the height.

Quote[/b] ]This should give you more accurate time slices:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">@(Call {player sidechat format ["%1",[_initPos,getpos _Missile] call dist2D ,Time]; !(isNull  _Missile)})

AFAIK @ runs as fast as the screen is refreshed. so the time data at least won't be uniform - it's hard to process.

thus I found my way better. may be the trajectory you seen is a result of incorrect code ? i can search for my grafics - i've never seen anything wierd.  

Quote[/b] ]Same here, but it's a shame it didn't come with any documentation

You talk about as about some hardware smile_o.gif there're some info can be found on wiki - its just a good way to analyse the data. Seems like MatLab got inbuild library - but i have no tine to deal with it

Share this post


Link to post
Share on other sites
Quote[/b] ]But I got no idea how to get into accout the height.

I see. Without knowing how BIS factor in drag and gravity it may never work with targets at different heights. The ballistics equation I used reduce the rounds velocity vectors based on a drag coefficent and other values like angle of attack e.t.c, over a period of time. Add to that gravity and the varying gun elevations you can use, it all gets pretty hard to predict over an extended time period.

Quote[/b] ]AFAIK @ runs as fast as the screen is refreshed. so the time data at least won't be uniform - it's hard to process.

I displayed a dialog screen while sampling the data. So the FPS was constant, and the sampling rate was always 0.001 seconds. Plus I could use the dialog to capture the results. But I have to say, I didn't have to worry about accurate timing. As long as I got a close approximation to the shells trajectory, I could compare it with the trajectory I calculated with my own equation using Excel.

Quote[/b] ]thus I found my way better. may be the trajectory you seen is a result of incorrect code ? i can search for my grafics - i've never seen anything wierd

Did you every try your method with the CoC style LGB bomb shells over distances greater than 7000 meters? The problem only shows up with ranges like that. If I though it would be useful to anyone I would knock up an addon and mission to demonstrate the problem?

The method I used was pre CoC UA. I could compensate for different target heights and it was accuarate to about 5m at the ranges forced by OFP's standard shell life, so it was ok for mortars. But it required a lot of scripting and became obselete once CoC released UA.

Quote[/b] ]You talk about as about some hardware  there're some info can be found on wiki - its just a good way to analyse the data. Seems like MatLab got inbuild library - but i have no tine to deal with it

Well I'm in the same boat. I have other things to learn, to solve more immediate problems. ATM I don't need a Neural Network for anything I'm doing, so it seems a waste of time learning it for nothing more than curiosity. Especially when someone has already gone to the trouble of putting it into OFP.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×