Contents
Class ChargeDistanceMath
java.lang.Object
com.hypixel.hytale.server.npc.util.ChargeDistanceMath
Charge travel distance and target stop range calculations.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doublestatic final doublestatic final doubleStop points closer than this do not launch a charge. -
Method Summary
Modifier and TypeMethodDescriptionstatic doublecomputeRequiredReachDistanceSquared(double chargeDistance, double targetDistanceSquared) Returns the squared clear-path distance, capped at the target because collision ends the charge.static doublecomputeStopPointDistance(double targetWaypointDistance, double targetStopDistance, double colliderDistance) Returns the distance to the target-relative stop point, adjusted by collider extents.static booleanisInsideStopRange(double stopPointDistance) static booleanisOutsideStopRange(double stopPointDistance) Returns whether the stop point cleared the stop range and its exit hysteresis.static booleanisReachableFromProbe(double reachedDistanceSquared, double requiredDistanceSquared, double targetDistanceSquared, boolean hasTarget, boolean boundingBoxesOverlapped) Returns whether the probe cleared the required distance.static doublelimitToChargeRange(double stopPointDistance, double maxChargeDistance)
-
Field Details
-
MIN_CHARGE_DISTANCE
public static final double MIN_CHARGE_DISTANCEStop 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 negativetargetStopDistanceplaces 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 fortargetDistanceSquaredwhen 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.
-