View Single Post
Old 12-18-10, 09:55 AM   #5471
TheDarkWraith
Black Magic
 
Join Date: Jun 2007
Posts: 11,962
Downloads: 147
Uploads: 5


Default

Quote:
Originally Posted by Vanilla View Post
BTW, forgot to mention - there is another division by zero issue - if the tracking angle is 0 or 180 then sine of it is zero as well.

In the cases of zero divisions we need to use torpedo speed and that returns us to the problems with torpedo run away and turn times.
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
TheDarkWraith is offline   Reply With Quote