Class ChargeDistanceMath

java.lang.Object
com.hypixel.hytale.server.npc.util.ChargeDistanceMath

public final class ChargeDistanceMath extends Object
Charge travel distance and target stop range calculations.
  • Field Details

    • MIN_CHARGE_DISTANCE

      public static final double MIN_CHARGE_DISTANCE
      Stop points closer than this do not launch a charge.
      See Also:
    • DISCARDED_PROBE_REACHED_DISTANCE_SQUARED

      public static final double DISCARDED_PROBE_REACHED_DISTANCE_SQUARED
      See Also:
    • DISCARDED_PROBE_REQUIRED_DISTANCE_SQUARED

      public static final double DISCARDED_PROBE_REQUIRED_DISTANCE_SQUARED
      See Also:
  • Method Details

    • computeStopPointDistance

      public static double computeStopPointDistance(double targetWaypointDistance, double targetStopDistance, double colliderDistance)
      Returns the distance to the target-relative stop point, adjusted by collider extents. A negative targetStopDistance places the point beyond the target. The result is not limited by the charge range.
    • limitToChargeRange

      public static double limitToChargeRange(double stopPointDistance, double maxChargeDistance)
    • computeRequiredReachDistanceSquared

      public static double computeRequiredReachDistanceSquared(double chargeDistance, double targetDistanceSquared)
      Returns the squared clear-path distance, capped at the target because collision ends the charge. Pass positive infinity for targetDistanceSquared when the charge has no target.
    • isReachableFromProbe

      public static boolean isReachableFromProbe(double reachedDistanceSquared, double requiredDistanceSquared, double targetDistanceSquared, boolean hasTarget, boolean boundingBoxesOverlapped)
      Returns whether the probe cleared the required distance. A probe that reaches its target must also report collider overlap.
    • isInsideStopRange

      public static boolean isInsideStopRange(double stopPointDistance)
    • isOutsideStopRange

      public static boolean isOutsideStopRange(double stopPointDistance)
      Returns whether the stop point cleared the stop range and its exit hysteresis.