Warning: include(/var/www/html/forum/Sources/../../../includes/depot_files/OFPEC_get_header_image.inc.php): failed to open stream: No such file or directory in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 146

Warning: include(): Failed opening '/var/www/html/forum/Sources/../../../includes/depot_files/OFPEC_get_header_image.inc.php' for inclusion (include_path='.:/usr/local/lib/php') in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 146

Notice: Undefined index: OFPEC in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152

Notice: Trying to access array offset on value of type null in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152

Notice: Trying to access array offset on value of type null in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152
    Home   Help Login Register  

Author Topic: More Math Woes  (Read 14412 times)

0 Members and 1 Guest are viewing this topic.

Offline drbobcat

  • Members
  • *
  • Rawr
More Math Woes
« on: 08 Jun 2008, 00:01:24 »
Although there are many artillery scripts out there that either utilize AI or clever "createVehicle"-ing, I believe it would be far more entertaining for the player if he or she was actually in the gunner's seat. I have been working non-stop on a script that does just that. A hint box offers the gunner data such as his current heading and angle, as well as the heading he'd need to take to be aiming at his target, the distance to his target, and the height difference between himself and the target. Obviously, the next thing needed is the angle at which the barrel must be in order for the shell to strike the target accurately.

My problem: I would like the shell to travel along a "perfect" parabola and strike a certain distance at a given angle. For example, at a thirty degree angle, I want the shell to land x meters away every single time. What kind of formula would I use? How would I go about this? The consideration of height can be dealt with at a later time.

I have already looked at many websites but have not been able to discover a solution to my specific problem. Here is a list of some of those sites....
Wikipedia
JBM
Formularium
Hyperphysics
Measurements Converter

An alternative solution may be to specify strict velocities based on the launch angle. Anyway, here is a copy of the main script...
Code: [Select]
if (!(local (_this select 0))) exitWith {};

_info =
{
_gun = _this select 0;

while {(alive _gun) && ((typeOf (vehicle player)) == "M119")} do
{
_xVec = (_gun weaponDirection "M119") select 0;
_yVec = (_gun weaponDirection "M119") select 1;
_zVec = (_gun weaponDirection "M119") select 2;

_tHead = ((getPos _gun select 0) - (getPos targ select 0)) atan2 ((getPos _gun select 1) - (getPos targ select 1));
_cHead = (_xVec atan2 _yVec);

if (_tHead < 0) then {_tHead = (180 - (abs _tHead))} else {_tHead = (180 + _tHead)};
if (_cHead < 0) then {_cHead = _cHead + 360};

_dist = ([getPos _gun select 0, getpos _gun select 1, 0] distance [getPos targ select 0, getPos targ select 1, 0]);
_hDiff = ((getPosASL _gun select 2) - (getPosASL targ select 2));
_ang = (asin ((9.8 * _dist) / 275000));

hint format ["Current Heading: %1 degrees\nCurrent Elevation: %2 degrees\n\nDistance-to-Target: %3 meters\nHeading-to-Target: %4 degrees\nElevation-to-target: %5 degrees\nHeight difference: %6 meters",_cHead,(_zVec * 90),_dist,_tHead,_ang,_hDiff];
sleep 0.01;
};
};

DRB_Art_Fired =
{
_gun = _this select 0;
_ammo = _this select 1;

_wAng = ((_gun weaponDirection "M119") select 0) atan2 ((_gun weaponDirection "M119") select 1);
_rounds = (_gun nearObjects [_ammo,1000]);
_round = objNull;
_located = false;

for [{_i = 0},{_i != (count _rounds)},{_i = _i + 1}] do
{
_round = _rounds select _i;
_rAng = (((vectorDir _round) select 0) atan2 ((vectorDir _round) select 1));
if ((abs (_wAng - _rAng)) <= 2) exitWith {_located = true};
sleep 0.001;
};

if (!(_located)) exitWith {};

switch (_gun getVariable "DRB_Art_Round_Type") do
{
case "he":
{
_he =
{
_round = _this select 0;
_spd = 275;

while {!(isNull _round)} do
{
_round setVelocity [_spd * (sin (getDir _round)),_spd * (cos (getDir _round)),(velocity _round select 2)];
sleep 0.01;
};
};

[_round] spawn _he;
};

case "illum":
{
_illum =
{
_round = _this select 0;
_time = 0;
_spd = 275;
_create = false;

_flare = objNull;

while {!(isNull _round)} do
{
_time = _time + 0.01;
_round setVelocity [_spd * (sin (getDir _round)),_spd * (cos (getDir _round)),(velocity _round select 2)];

if (((getPos _round select 2) <= 300) && (_time >= 2) && (!(_create))) then
{
_flare = "F_40mm_White" createVehicle [0,0,5000];
_create = true;
};

if (((getPos _round select 2) <= 150) && (_time >= 2)  && (_create)) then
{
_rPos = (getPos _round);
deleteVehicle _round;
_burst = "weaponHolder" createVehicle [0,0,5000];
_burstB = "G_40mm_HE" createVehicle [0,0,5000];
{_x setPos _rPos} forEach [_burst,_burstB];
sleep 0.25;
_flare setPos _rPos;
{deleteVehicle _x} forEach [_burst,_burstB];
};

sleep 0.01;
};
};

[_round] spawn _illum;
};

case "prox":
{
_prox =
{
_round = _this select 0;
_time = 0;
_spd = 275;

_burst = "weaponHolder" createVehicle [0,0,5000];

while {!(isNull _round)} do
{
_time = _time + 0.01;
_round setVelocity [_spd * (sin (getDir _round)),_spd * (cos (getDir _round)),(velocity _round select 2)];

if (((getPos _round select 2) <= 50) && (_time >= 2)) then
{
_round setVelocity [0,0,0];
_rPos = getPos _round;
{_x setPos _rPos} forEach [_burst,_round];
sleep 0.25;
{deleteVehicle _x} forEach [_burst,_round];
};

sleep 0.01;
};
};

[_round] spawn _prox;
};

case "smoke":
{
_smoke =
{
_round = _this select 0;
_time = 0;
_spd = 275;
_create = false;

_burst = objNull;
_smokeA = objNull;
_smokeB = objNull;
_smokeC = objNull;
_smokeD = objNull;
_smokeE = objNull;
_smokeF = objNull;
_smokeG = objNull;
_smokeH = objNull;
_smokeI = objNull;
_smokeJ = objNull;
_smokeK = objNull;
_smokeL = objNull;
_smokeM = objNull;
_smokeN = objNull;
_smokeO = objNull;
_smokeP = objNull;
_smokeQ = objNull;

while {!(isNull _round)} do
{
_time = _time + 0.01;
_round setVelocity [_spd * (sin (getDir _round)),_spd * (cos (getDir _round)),(velocity _round select 2)];

if (((getPos _round select 2) <= 100) && (_time >= 2) && (!(_create))) then
{
_burst = "G_40mm_HE" createVehicle [0,0,5000];
_smokeA = "SmokeShell" createVehicle [0,0,5000];
_smokeB = "SmokeShell" createVehicle [0,0,5000];
_smokeC = "SmokeShell" createVehicle [0,0,5000];
_smokeD = "SmokeShell" createVehicle [0,0,5000];
_smokeE = "SmokeShell" createVehicle [0,0,5000];
_smokeF = "SmokeShell" createVehicle [0,0,5000];
_smokeG = "SmokeShell" createVehicle [0,0,5000];
_smokeH = "SmokeShell" createVehicle [0,0,5000];
_smokeI = "SmokeShell" createVehicle [0,0,5000];
_smokeJ = "SmokeShell" createVehicle [0,0,5000];
_smokeK = "SmokeShell" createVehicle [0,0,5000];
_smokeL = "SmokeShell" createVehicle [0,0,5000];
_smokeM = "SmokeShell" createVehicle [0,0,5000];
_smokeN = "SmokeShell" createVehicle [0,0,5000];
_smokeO = "SmokeShell" createVehicle [0,0,5000];
_smokeP = "SmokeShell" createVehicle [0,0,5000];
_smokeQ = "SmokeShell" createVehicle [0,0,5000];
_create = true;
};

if (((getPos _round select 2) <= 5) && (_time >= 2) && (_create)) then
{
_rPos = (getPos _round);
deleteVehicle _round;
_burst setPos [(_rPos select 0),(_rPos select 1),0];
_smokeA setPos [(_rPos select 0) + 5,(_rPos select 1),0];
_smokeB setPos [(_rPos select 0) - 5,(_rPos select 1),0];
_smokeC setPos [(_rPos select 0),(_rPos select 1) + 5,0];
_smokeD setPos [(_rPos select 0),(_rPos select 1) - 5,0];
_smokeE setPos [(_rPos select 0) + 3.75,(_rPos select 1) + 3.75,0];
_smokeF setPos [(_rPos select 0) + 3.75,(_rPos select 1) - 3.75,0];
_smokeG setPos [(_rPos select 0) - 3.75,(_rPos select 1) + 3.75,0];
_smokeH setPos [(_rPos select 0) - 3.75,(_rPos select 1) - 3.75,0];
_smokeI setPos [(_rPos select 0) + 10,(_rPos select 1),0];
_smokeJ setPos [(_rPos select 0) - 10,(_rPos select 1),0];
_smokeK setPos [(_rPos select 0),(_rPos select 1) + 10,0];
_smokeL setPos [(_rPos select 0),(_rPos select 1) - 10,0];
_smokeM setPos [(_rPos select 0) + 7.5,(_rPos select 1) + 7.5,0];
_smokeN setPos [(_rPos select 0) + 7.5,(_rPos select 1) - 7.5,0];
_smokeO setPos [(_rPos select 0) - 7.5,(_rPos select 1) + 7.5,0];
_smokeP setPos [(_rPos select 0) - 7.5,(_rPos select 1) - 7.5,0];
_smokeQ setPos [(_rPos select 0),(_rPos select 1),0];
};

sleep 0.01;
};
};

[_round] spawn _smoke;
};
};

_cam = "camera" camCreate (getPos _gun);
_cam cameraEffect ["INTERNAL","BACK"];
_cam camSetTarget _round;
_cam camCommit 0;

_time = 0;
_dist = 0;

while {!(isNull _round)} do
{
_time = _time + 0.01;
_dist = _gun distance _round;
titleText [(format ["%1 kmh \n%2 seconds \n%3 meters traveled \n%4 z velocity", speed _round, _time, _dist, (velocity _round select 2)]),"PLAIN DOWN"];
_cam camSetRelPos [0,-40,20];
_cam camCommit 0;
sleep 0.01;
};

sleep 5;

_cam cameraEffect ["TERMINATE","BACK"];
camDestroy _cam;
};

while {true} do
{
waitUntil {((typeOf (vehicle player)) == "M119")};
_gun = (vehicle player);
[_gun] spawn _info;
_fired = _gun addEventHandler ["fired","[_this select 0,_this select 4] spawn DRB_Art_Fired"];
_act1 = _gun addAction ["Change Type (HE)","DRB_ChangeRoundType.sqf","he",-1,false,true,""];
_act2 = _gun addAction ["Change Type (Illum)","DRB_ChangeRoundType.sqf","illum",-2,false,true,""];
_act3 = _gun addAction ["Change Type (Prox)","DRB_ChangeRoundType.sqf","prox",-3,false,true,""];
_act4 = _gun addAction ["Change Type (Smoke)","DRB_ChangeRoundType.sqf","smoke",-4,false,true,""];
waitUntil {((typeOf (vehicle player)) != "M119") || !(alive player)};
_gun removeEventHandler ["fired",_fired];
_gun removeAction _act1;
_gun removeAction _act2;
_gun removeAction _act3;
_gun removeAction _act4;
};

My thanks,
- dRb

Offline Rommel92

  • Members
  • *
Re: More Math Woes
« Reply #1 on: 08 Jun 2008, 07:02:46 »
Just broad thinking, but you would first have to measure the exact velocity and its air friction to estimate the maximum (turning point) of the parabola, its propulsion velocity and then angles its fired off at. Come up with an equation for this and your set.

 :dunno:

Offline drbobcat

  • Members
  • *
  • Rawr
Re: More Math Woes
« Reply #2 on: 08 Jun 2008, 09:58:36 »
That is what I am trying to do, yes, but this is all displayed to the gunner PRIOR to firing, not after. Therefore, I need a way to calculate the velocities before hand. Additionally, I do not plan on simulating air friction at all. Let's keep trying to work at this, shall we? I am eager to work past this hurdle, design a few resources for the suite and perhaps even make an addon out of it.

Thank you,
- dRb
« Last Edit: 10 Jun 2008, 17:33:17 by h- »

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: More Math Woes
« Reply #3 on: 08 Jun 2008, 11:47:04 »
It is not that you need to simulate air friction, is that air friction is already there. You are "keeping" constant the horizontal speed of the round while vertical speed is somewhat free, that last component of your velocity vector is already affected in the game by gravity and air friction of the moving object. If you want to simulate a round in the vacuum, then you need to calculate your "no-friction" Z component too, if not, then you need to calculate the real initial velocity vector (only once), apply to the round (including correct initial vectorDir and vectorUP) and then let the round free.

Offline drbobcat

  • Members
  • *
  • Rawr
Re: More Math Woes
« Reply #4 on: 08 Jun 2008, 12:26:56 »
Precisely, yes. Since I already have a method to calculate the current angle of the barrel, I just need a formula that applies a fixed z-velocity to the next round fired. I have (speed * (sin roundDirection)) for the 'x' velocity and (speed * (cos roundDirection)) for the 'y.' What for the 'z?' My last scholastic dive into trigonometry was too many years ago and I am completely stumped. I imagine I will be able to somehow discover an accurate angle for the gunner through reverse engineering.

- dRb

EDIT: To reiterate my objectives just so all is less confusing....
1) Provide an angle of launch to the gunner before he fires so his shot is relatively accurate.
2) Eliminate drag on the shell as it travels through the air so that it can travel smoothly regardless of the distance.

I will reinstate drag and deviation by applying -small- alterations to the individual velocity speeds using random numbers. Controlled chaos?

EDIT 2: I am not taking into consideration ArmA's air friction at this moment because: (A) there is an utter lack of data regarding how and what the ballistic system calculates, and (B) it would become vastly more complex even than it is now.
« Last Edit: 08 Jun 2008, 12:48:00 by drbobcat »

Offline Rommel92

  • Members
  • *
Re: More Math Woes
« Reply #5 on: 08 Jun 2008, 15:43:02 »
And heres my steps to you.

Calculate vectorDir on cannon. So say if cannon is fired at 45 degrees (upwards) then do a monitoring script on the round that comes out of it. So many different angles will have to be tested and different conditions aswell.

The monitor script must store the following data:

Round Velocity at a minimum of 6 points for:

-Gravity.
-Air Friction
-Speed of Round

Highest Point (maximum (M))
- More Data for Above Calculations.
- Necessary to help find the equation.

Have fun with the testing, return the results.  :good:

EDIT:
The reason air friction is necessary to be aware of is because it is a constant de-cellaration, as with ArmA's gravity, and hence is a constant problem for you to think about. What else makes the round fall on target?

Your parabola also should look something like this:
Artillery Piece
X intercept (Hitting the Ground)
Round Trace


Note: Incredibly dramatic air friction there, purely for example purposes. Also disregard the straightness of the lines drawn.
« Last Edit: 08 Jun 2008, 15:53:40 by Rommel92 »

Offline drbobcat

  • Members
  • *
  • Rawr
Re: More Math Woes
« Reply #6 on: 08 Jun 2008, 21:52:07 »
Alright. It seems to me that this is going to be more difficult than I had first expected. However, the rewards are more than worth it in my mind. I will continue to report my progress in this thread so you all may point out any significant errors I may fail to notice immediately. Before I begin, here are a few more small questions.

1) What is the measurement for gravity in ArmA? 9.8 m/s? 10 m/s? 9 m/s? Has this been documented?
2) In what unit of measurement are the three different values in the "setVelocity" and "velocity" commands? I first thought that the magnitude of the vector between x and y would be equal to forward speed, or ~1000-1100 kmh. That turned out to be incorrect. This is a rough estimate of the data I was able to gather when the gun fired a shell at a 45 degree angle.

- Z velocity: 550 wtf (whatever-the-*** a velocity array element measures...)
- XY velocity: 275 wtf (in total, I mean. Their readout depends on the direction the gun is fired)
- Magnitude: 615 wtf (To the best of my knowledge, the magnitude of the velocity vector is determined by applying the Pythagorean Theorem to the previous measurements. Am not entirely sure)

Rommel, are implying that I should create a kind of "database" that stores all the data needed for each possible angle? Just in my brief tests with the "flawed" system, there are -significant- differences between one degree and another, even up to the hundreth decimal place! It would take weeks of nonstop testing to find (88 * 10 * 10) or 8800 different degree readouts! That is simply not a possibility. There must be a better way... If I have misinterpreted you, please correct me.

*sigh* Back into the fray,
-dRb

EDIT:
Quote
The reason air friction is necessary to be aware of is because it is a constant de-cellaration, as with ArmA's gravity, and hence is a constant problem for you to think about. What else makes the round fall on target?

Could not gravity act as a decent decelleration factor alone? How is air friction in ArmA even modeled? Does it change or is it a constant, fixed number? Would it be providing lateral decelleration and gravity providing vertical decelleration?
« Last Edit: 08 Jun 2008, 22:07:58 by drbobcat »

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: More Math Woes
« Reply #7 on: 08 Jun 2008, 23:29:47 »
Gravity decelerates the "ascension" and accelerates the descension, air friction deceletares any movement of the round, even the descension. Imagine you are firing the round inside water and you have water friction instead of air friction.

velocity vector components are in meters per second.
Now, if you want to achieve a more or less "automatically" calculated heading and elevation then the gunner will just hit the target area always with a maximum defined dispersion but no way to predict dispersion or circular error possible from the target. Obviously the initial speed of the round will make it imposible to see by any observer, same when the round hits the ground. So, if it works, it would be the very same as onMapSingleClick effect with a round spawned inside the circular error possible of the round type/gun type combo, that is, the same effect of having an arty calculator but without the calculator.

If not, then it is up to the gunner to set the elevation based on a table of elevations/angles/round types. Lets say you already have the initial muzzle velocities of your round types in m/s (real ones), so you simply intercept the Fired event handler, get the round, remove it and switch by another new one, you set the same vectorDir and upVector as the deleted round and then apply the corresponding velocity vector of the initial muzzle vel, then you record the position of the round until it is null (it hits the ground), and you calculate the distance between this position and the gun. You may set a table with 2 degrees intervals of elevation and show it using a dialog. Then a observer needs to provide the aproximate coords of the target, the gunner needs to calculate distance and set elevation manually based on your tables and then fire (or select round type and fire).

Anything else would be an automatic arty calculator.

Offline drbobcat

  • Members
  • *
  • Rawr
Re: More Math Woes
« Reply #8 on: 09 Jun 2008, 01:14:40 »
Okay. Here is how I envisioned the system to work when I first began working on it. Assume we are talking about a multiplayer game and all the participants are players.

1) A forward observer or radio operator would request a fire mission using whatever means he wished (chat/VON)
2) The officer in charge of the artillery battery would have access to an option that, upon clicking on the map once, would offer him data such as the distance to the target in meters, the height difference between the battery site and the target area, the heading needed to be aiming at the target, and the angle at which the guns on the battery line must set themselves for their rounds to land in the right area. Those calculations would be given for EACH gun at the site because the differences between 6+ guns along a large stretch of land would greatly impact their accuracy.
3) The officer would then give all the numbers required to each of the cannons under his command and would be able to monitor their heading and elevation angles on a separate readout.
4) Once all the numbers seem to meet up correctly, he'd give the command to open fire.

The main goals I had hoped to achieve were realism gameplay elements (a three-pronged communication line) and yet also maintain simplicity at the same time. It would be impractical and unfair of me to expect each person who wished to play the role of battery commander to be a highly competent mathematician. Even if I were to factor out air resistance and have the path of the round take the shape of a smooth parabola, height differences between the target location and the gun would make the task rightfully challenging (rounds would land fall short if the target were to be above the cannon on the z-axis, long if the target were below). Additionally, I would not be above formulating a separate angle calculation for high-angle firing (a tactic often used to hit the same area and yet avoid striking land prematurely). I find these sort of compromises to be balanced healthily between the realism and "arcade" polar extremes. Any thoughts from you folks?

Sadly, I do not believe it is possible to derive a parabola solely from an angle-of-launch. I probably -will- have write up a table for all the possible angles instead. *sigh*

- dRb

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: More Math Woes
« Reply #9 on: 09 Jun 2008, 02:48:48 »
Is this the same as this?

Offline drbobcat

  • Members
  • *
  • Rawr
Re: More Math Woes
« Reply #10 on: 09 Jun 2008, 03:53:21 »
In many respects, yes, but I want to take his concept further by predicting the angle-of-launch before hand, not merely by trial and error repetitive firing.

Even though I have found out how to obtain a z velocity from the z vector...

(gunBarrelZVector * 90) * 12.167 = roundZVelocity

... I still am suffering from a terribly annoying contradiction: in order to determine the angle of launch needed to strike a target from a given distance, I must be able to predict what velocity the round will take when it is fired. That velocity is the average of the xy velocities and the z velocity. As just mentioned, though, to find the z velocity, we must look at the current angle of the barrel. How can we figure out what angle to launch at if the data it depends on is always changing? I'll have to try something else. That likely means a large chart/table of with all the possible angles and their corresponding distances.

-dRb

Offline Rommel92

  • Members
  • *
Re: More Math Woes
« Reply #11 on: 09 Jun 2008, 07:19:18 »
Your in need of a table with the following information.

Projectile   Position A Coordinates | Velocity   Position B Coordinates | Velocity   Maximum Coordinates | Velocity   XY Vector   Z Vector
Round A:
Round B:
Round C:
Round D:
Round E:
Round F:

For measurement purposes, getPosASL (above sea level) measurement is used, and the cannon is fired 1M above sealevel. (Simple getPos above the water). This gives a level playing ground for measurements.

Code: (Monitor.SQF) [Select]
_cannon = _this select 0;
<insert Mando code here>
_round = _this select 1;

_posA = getPosASL _round;
_posAV = velocity _round;
_M = 0;

while {_M <= getPosASL _round select 2} do
{
_M = getPosASL _round select 2;
_MV = velocity _round;
hint format["MAXIMUM: %1",_M];

sleep 0.02;
};

waitUntil {getPosASL _round select 2 < 2};

_posB = getPosASL _round;
_posBV = velocity _round;

hint format ["XY Vector: %1 --- Z Vector: %2 --- PosA: %3 --- PosA Velocity: %4 --- PosB: %5 --- PosB Velocity: %6 --- Maximum: %7 --- Point M Velocity: %8",_xyVector,_zVector,_posA,_posAV,_posB,_posBV,_M,_MV];

Insert Mando code is basically the code to obtain the XY vector of the artillery piece (simple getDir?) and the obtaining of the Z vector (unsure how to).
From these results you can obtain the velocity, determine gravity and air friction.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: More Math Woes
« Reply #12 on: 09 Jun 2008, 23:18:58 »
If you are looking for a arty calculator then you have two problems:
- As said, drag already affects the rounds in ArmA, so you cannot use any basic vacuum parabolic formula because low and high resulting angles will always result in a miss. This way you would calculate two angles for a hit position as if you take Rommel92's drawing and mirror the left quadrant trajectory in the right quadrant. This case affects to a basic calculation resulting in two angles based on a range and an initial speed (in this case horizontal speed would keep constant).

- If you want to really force a parabolic trajectory then you need to guide the round all the time until impact to nullify the drag effect setting for each time its correct velocity, dir and up vectors.

Offline The_Mark

  • Members
  • *
Re: More Math Woes
« Reply #13 on: 12 Jun 2008, 17:34:15 »
Well, from the assumption that drag force in Arma behaves like F~v^2 (as in the drag equation) we can derive the trajectory. Here's a 2-dimensional solution with no wind assumed:

x(t)=(-e-k t vx0)/k +  vx0/k + x0,

y(t)=-(g t)/k - (e-k t (vy0 + g/k))/k + (vy0 + g/k)/k + y0

The orange bits are integration constants to place the muzzle at (x0, y0) and the red bits to fix the initial velocity to (vx0, vy0). k is a constant that has to be derived experimentally. Happy hunting :)


Edit: Screwed the calculations - no wonder the result was that simple. F~v^2 produces a bit more complicated results; the above is actually for the assumption F~v, which might work as well; at least it creates plausible trajectories.
« Last Edit: 13 Jun 2008, 00:23:10 by The_Mark »
Silent enim leges inter arma.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: More Math Woes
« Reply #14 on: 12 Jun 2008, 18:05:26 »
Good happy hunting proposal.  :D