Advertisement
Guest User

Untitled

a guest
Mar 24th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.       private function calculateTrackSpeedR(param1:Track, param2:Number) : void
  2.       {
  3.          var k_V:int =
  4.          var k_aV:int =
  5.          var linearMovementDirection:int =                                                  // -1 0 +1
  6.          var angularMovementDirection:int =                                                 // -1 0 +1
  7.          var moduleV:int =                                                                  // Модуль текущей скорости танка
  8.          var moduleaV:int =                                                                 // Модуль текущей угловой скорости танка
  9.          var rightTrackSpeed:Number = 0;
  10.          if((linearMovementDirection != 0) && (angularMovementDirection == 0))
  11.          {
  12.             rightTrackSpeed = linearMovementDirection * k_V * moduleV;
  13.          }
  14.          else if((linearMovementDirection == 0) && (angularMovementDirection != 0))
  15.          {
  16.             rightTrackSpeed = -angularMovementDirection * k_aV * moduleaV;
  17.          }
  18.          else if((linearMovementDirection != 0) && (angularMovementDirection < 0))
  19.          {
  20.             rightTrackSpeed = (3 / 4) * linearMovementDirection * k_V * moduleV;
  21.          }
  22.          else if((linearMovementDirection != 0) && (angularMovementDirection > 0))
  23.          {
  24.             rightTrackSpeed = (4 / 3) * linearMovementDirection * k_V * moduleV;
  25.          }
  26.          else
  27.          {
  28.             rightTrackSpeed = 0;
  29.          }
  30.          if(moduleV < minSpeed)
  31.          {
  32.             rightTrackSpeed = 0.05 * rightTrackSpeed
  33.          }
  34.       }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement