Class Predict

java.lang.Object
mindustry.entities.Predict

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

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static arc.math.geom.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.
    static arc.math.geom.Vec2
    intercept(arc.math.geom.Position src, arc.math.geom.Position dst, float v)
     
    static arc.math.geom.Vec2
    intercept(arc.math.geom.Position src, arc.math.geom.Position dst, float offsetx, float offsety, float v)
     
    static arc.math.geom.Vec2
    intercept(mindustry.gen.Hitboxc src, mindustry.gen.Hitboxc dst, float v)

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Predict

      public Predict()
  • Method Details

    • intercept

      public static arc.math.geom.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 arc.math.geom.Vec2 intercept(arc.math.geom.Position src, arc.math.geom.Position dst, float v)
    • intercept

      public static arc.math.geom.Vec2 intercept(arc.math.geom.Position src, arc.math.geom.Position dst, float offsetx, float offsety, float v)
    • intercept

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