Jump to content
Sign in to follow this  
xendance

How is air resistance applied to rockets/bombs?

Recommended Posts

I've been working on a CCIP script for jets. I use Euler's method to approximate the flight path of the projectile which works nicely.

The actual process goes like:

Determine the velocity for each velocity vector: v ↠v + Δv = v + a*Δt

Determine the position for each axis: pos ↠pos + Δpos = pos + v*Δt

Rinse and repeat until we hit ground.

The problem is that I don't know how air friction is applied to the equation. I've been also puzzled by the fact that missiles/rockets have positive airFriction config, while bullet type projectiles have negative.

Does anyone know how to apply the air friction to the equation?

Share this post


Link to post
Share on other sites
As far as bombs go there's 0 air resistance.

Rockets/missiles won't be any different I guess.

I doubt this will change.

http://feedback.arma3.com/view.php?id=18188

Thanks but I'm looking for the actual equation. As in how does the air friction coefficient affect the acceleration of an object, because it clearly does affect rockets.

Share this post


Link to post
Share on other sites

Actually, I'm not sure if I'm calculating the rocket thrust ok...

Here's the code I'm using (I snipped some unnecessary portions off):

//total velocity accounts for aircraft speed
_vx = _totalVelocityX;   
_vy = _totalVelocityY;             
_vz = _totalVelocityZ;

//_pos is aircraft position
_posX = _pos select 0;
_posY = _pos select 1;
_posZ = _pos select 2;


//590 is just the max speed the rocket has, actual thrust/mass doesn't give enough acceleration
_accelerationV = [_gunUnitV, 590]call CBA_fnc_scaleVectTo;

for "_i" from 1 to _maxIterations do {
private["_ax","_ay","_az"];

//_dt = _maxResolution min (_i^-1);
//_dt = _dt max _minResolution;
_dt = GLOBAL_DT;
_elapsedTime = _elapsedTime + _dt;

_ax = 0;
_ay = 0;
_az = -_gravity;


if(_elapsedTime < _thrustTTL) then {
	_ax = _ax + (_accelerationV select 0);
	_ay = _ay + (_accelerationV select 1);
	_az = _az + (_accelerationV select 2);
};

//http://physics.gmu.edu/~amin/phys251/Topics/NumAnalysis/Odes/projectileMotion.html
_Vmagnitude = sqrt(_vx^2 + _vy^2 + _vz^2);
//disable this for now
	_FdragX = 0;//_airFriction * _Vmagnitude * _vx;
	_FdragY = 0;//_airFriction * _Vmagnitude * _vy;
	_FdragZ = 0;//_airFriction * _Vmagnitude * _vz;

//determine the velocity: v  ↠ v + Δv = v + a*Δt
_vx = _vx + (_ax - _FdragX) * _dt;
_vy = _vy + (_ay - _FdragY) * _dt;
_vz = _vz + (_az - _FdragZ) * _dt;

//determine the position: pos  ↠ pos + Δpos = pos + v*Δt
_posX = _posX + _vx * _dt;
_posY = _posY + _vy * _dt;
_posZ = _posZ + _vz * _dt;
}

And that gives me following result:

http://cloud-2.steampowered.com/ugc/579018011189692481/C9CB8AF35EBD4D9E162A7867B4DCE625AB57B710/

http://cloud-3.steampowered.com/ugc/579018011189694649/EB5FAAC1979250D9FC4A45F338C6254E3312082D/

You can see that the estimation is way short, and would be even more short if I applied air friction...

So I suppose my new question is: How is the rocket/missile acceleration calculated in the engine?

Share this post


Link to post
Share on other sites

I think I managed to reverse engineer it. Red line was done with the projectile path tracing script and the dashed line is my script's estimation (dashes represent the time steps). It seems close enough to me:

http://cloud-3.steampowered.com/ugc/576766755283217560/F7E86F86F67624CF1C9E9E5E4E4708DAB31231D9/

http://cloud-2.steampowered.com/ugc/576766755283219098/85E8FB045124D2E8103E3B0EB6F73B885B8C58D4/

http://cloud-3.steampowered.com/ugc/576766755283220122/DEBAAE9C8992C7EF6110E7B386C325C5A1D0546D/

Next up: do the same for bombs and double check everything works while flying.

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  

×