Homefry 0 Posted September 11, 2005 For some time now I've been trying to figure out exactly what equations BIS used to calculate physics in OFP. The main equation I'm after is the equation for freefall objects, such as bombs released from aircraft. I've messaged Suma before, and was told: Quote[/b] ]The realistic one - gravity causes acceleration 9.066 m/s^2. The speed of the falling objects however depends on other things as well, mostly air friction. Perhaps there is someone floating around the OFP world that was a physics major in college? I took physics in high school, and understand general things, but I never learned how to equate for air resistance and the like. Any help or ideas would be great. Share this post Link to post Share on other sites
deanosbeano 0 Posted September 11, 2005 along time ago in bis forums a group, did a big test on the physics on ofp, mainly on bullets i think ,maybe you can search it, sorry i dont have time good luck found this called quantum quantum Share this post Link to post Share on other sites
Doolittle 0 Posted September 11, 2005 A lot of work was put into trying to figure out that very thing you ask. Check out http://www.flashpoint1985.com/cgi-bin....94;st=0 and http://www.flashpoint1985.com/cgi-bin....iew=new... and the end result of all of this was Dinger from Chain of Command and their Universal Artillery, though I believe this relies on range tables, not on a single equation. Doolittle Share this post Link to post Share on other sites
[aps]gnat 28 Posted September 12, 2005 Below is part of my upcoming Virtual Bomber addon. It resonably predicts when a level flying Bomber should release its bomb load. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _DropMark = _BomberLead + (sqrt((2 * _BomberHeight)/9.8) * _BombFactor) #dropbomb2 ~0.1 _Abort = _Abort + 1 ?(_Abort > 4200) : goto "AbortRun" _BomberXpos = ((getpos (leader _TeamX)) select 0) _BomberYpos = ((getpos (leader _TeamX)) select 1) _BomberDistance = Sqrt(((_MarkerXpos-_BomberXpos)^2)+((_MarkerYpos-_BomberYpos)^2)) _HSpeed = (speed vehicle (leader _TeamX)*1000)/(60*60) ?(_BomberDistance > (_DropMark * _HSpeed )) : goto "dropbomb2" #ReleaseBomb "[_x,_weapon,_ammoname,_dropnumber,_dropdelay] exec {\GNT_VBomber\dropbombs.sqs}" forEach _BGroup goto "AReturn" Ignore _BomberLead and _Bombfactor, these are not critical to the calculation, only "adjusters". _TeamX is the bomber. The bomb "sidefriction" config can effect this greatly but I have not been able to convert BIS's number into an adjusting formula. For most free fall bombs (friction ~0.2) the above works well enough. Share this post Link to post Share on other sites
Homefry 0 Posted September 12, 2005 @deanosbeano: Thanks for the link mate, there seems to be a lot of information in there. @Doolittle: All two threads are proving very helpful, and since I've tried UA, I can attest to the accuracy of what you guys did. I'll see if I can't come up with something typing the range tables together perhaps... we'll see. @[APS]Gnat This "sidefriction" value in the config.... well that's pretty interesting. I wonder what would happen if we changed that value to 0... wouldn't that help figure something out? Share this post Link to post Share on other sites
[aps]gnat 28 Posted September 12, 2005 I wonder what would happen if we changed that value to 0... wouldn't that help figure something out? Sure, but the Virtual Bomber addon is an addon to take advantage of OTHER peoples bomber addons, hence I don't have control over their bombs config, I just need to know what it is and manually adjust the calculation with a "factor". Share this post Link to post Share on other sites
Doolittle 0 Posted September 13, 2005 What about finding an object that friction doesn't effect. Does air friction affect cameras? Or furniture, or shell ejections? Share this post Link to post Share on other sites
UNN 0 Posted September 13, 2005 The closes thing I've seen to a Drag Coefficient in OFP uses this iterative method: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_TargetHeight= _This select 0 _IntAngle = _This select 1 _CurrCd = _This select 2 _IntVelocity= _This select 3 _CurrRange = _This select 4 _Index = _This Select 5 _Reverse = _This Select 6 ;Initialise local variables _TimeInt = 0.1 _IntRho = 0.1 _Gravity = 9 _XPos = 0 _YPos = 0 _DelX = 0 _DelY = 0 _DelVx = 0 _DelVy = 0 _Angle = 0 _FlightTime = 0 _InFlight = True _Return = [0,0] _Rho = _IntRho _Velocity = _IntVelocity^2 _Angle = _IntAngle _Vx = _IntVelocity*Cos(_Angle) _Vy = _IntVelocity*Sin(_Angle) _CurrCd = _CurrCd / 10000 _XPercentage= (_CurrRange / 100)*80 ;Calculate the trajectory #InFlight @(True) ;Calculate how much of the velocity is lost to drag and gravity _DelVx = (-_TimeInt*((_Rho*_CurrCd)))*_Velocity*Cos(_Angle) _DelVy = -_TimeInt*_Gravity-(_TimeInt*(_Rho*_CurrCd))*_Velocity*Sin(_Angle) ;Over a period of 0.1 seconds _DelX = _TimeInt*(_Vx+_DelVx) _DelY = _TimeInt*(_Vy+_DelVy) ;Adjust the velocity _XPos = _XPos+_DelX _YPos = _YPos+_DelY ;Increment the time in flight _FlightTime = _FlightTime+_TimeInt ;The trajectory has hit the ground so store the result and end the loop If !(_Reverse) Then {If ((_YPos < _TargetHeight) and (_XPos > _XPercentage)) then {_InFlight = False; _Return = [_XPos,_FlightTime]}} Else {if (_YPos < _TargetHeight) then {_InFlight = False; _Return = [_XPos,_FlightTime]}} ;Prepare for the next time slice _Rho = _IntRho*Exp(-0.000057*_YPos) _Angle = ATan(_DelY/_DelX) ;Reposition the round according to the new velocity _Vx = _Vx+_DelVx _Vy = _Vy+_DelVy ;Calculate the new velocity _Velocity = (_Vx^2)+(_Vy^2) ;See if the shell has landed If (_InFlight) Then {goto "InFlight"} ;Save the result to the array [_Index,+_Return,FCU_TRAJECTORY] Call FCU_SetIndexStatus ;Tell GroupRange.sqs we have a result [_Index,False,FCU_CALCULATING] Call FCU_SetIndexStatus CurrCd is the coefficient and comes out as 0.00525. I got gravity to 9, so not far off the 9.22 as quoted by Suma. With a bit of trial and error, varying the cofficent lets me adjust the trajectory for different addons. Might not help much with a virtual bomber, as it takes a few seconds to calculate an impact point even at short ranges like 2500 meters. Share this post Link to post Share on other sites