Class Predict

java.lang.Object
mindustry.entities.Predict

public class Predict extends Object
Class for predicting shoot angles based on velocities of targets.
  • Constructor Details

    • Predict

      public Predict()
  • Method Details

    • intercept

      public static Vec2 intercept(float srcx, float srcy, float dstx, float dsty, float dstvx, float dstvy, float v)
      Calculates of intercept of a stationary and moving target. Do not call from multiple threads!
      Parameters:
      srcx - X of shooter
      srcy - Y of shooter
      dstx - X of target
      dsty - Y of target
      dstvx - X velocity of target (subtract shooter X velocity if needed)
      dstvy - Y velocity of target (subtract shooter Y velocity if needed)
      v - speed of bullet
      Returns:
      the intercept location
    • intercept

      public static Vec2 intercept(Position src, Position dst, float v)
    • intercept

      public static Vec2 intercept(Position src, Position dst, float offsetx, float offsety, float v)
    • intercept

      public static Vec2 intercept(mindustry.gen.Hitboxc src, mindustry.gen.Hitboxc dst, float v)