Quote:
Originally Posted by TheDarkWraith
True true. But I still can't get Antar's formula to work correctly. Comparing the values it returns to the torp line's time doesn't even come close
Here's the code I have for it:
Code:
# get the target's speed
ts = Menu.GuiDials.GetValue( GuiDialsWrapper.DialTypes.SOL_SPEED )
if ts == 0:
ts = 0.000001
# get the distance to target
td = Menu.GuiDials.GetValue( GuiDialsWrapper.DialTypes.SOL_RANGE )
# get the target's AOB from the TDC dial
taob = abs( Menu.GuiDials.GetValue( GuiDialsWrapper.DialTypes.SOL_ANGONBOW ) )
# get the track angle
tangle = abs( Menu.GuiDials.GetValue( GuiDialsWrapper.DialTypes.SOL_TRACKANGLE ) )
# calculate 3rd angle of triangle
auxangle = radians( 180 - taob - ( 180 - tangle ) )
s_ship = td * ( sin( auxangle ) / sin( radians( 180 - tangle ) ) )
s_torp = td * ( sin( radians( taob ) ) / sin( radians( 180 - tangle ) ) )
#to hit torp.time = ship.time
impacttime = int( round( s_ship / ts ) )
impacttimemins = impacttime / 60
impacttimesecs = impacttime - ( impacttimemins * 60 )
I don't understand why we're calculating s_torp when we never use it
Using the TDW_Torp_Tutorial single mission when I set up the shot the torp line says ~2:33 to impact and the caculated values above say 0:35
|
I guess we forgot to convert knots to m/s.

Do you get knots from the speed dial? if yes - multiply it by 0.514444 to get m/s.
Another thing: impacttimemins is int or float/double? If float - then you will always get zero seconds.