Class DirectionalHitBox

java.lang.Object
com.hypixel.hytale.server.core.modules.projectile.component.DirectionalHitBox
All Implemented Interfaces:
Component<EntityStore>, Cloneable

public class DirectionalHitBox extends Object implements Component<EntityStore>
The hit shape of a piercing projectile, rotated by its yaw. Entity hit volumes are axis-aligned and never rotate, so a wide-thin projectile authors a square axis-aligned hitbox as the first pass and this shape as the second: a registered contact only counts when the victim lies within the width across and the depth along the travel direction. Horizontal only; the hitbox's own height bounds the vertical.
  • Constructor Details

    • DirectionalHitBox

      public DirectionalHitBox(double halfWidth, double halfDepth)
  • Method Details

    • getComponentType

      public static ComponentType<EntityStore, DirectionalHitBox> getComponentType()
    • contains

      public boolean contains(float yaw, @Nonnull org.joml.Vector3d origin, @Nonnull org.joml.Vector3d victimPosition, double victimHalfExtent)
      Tests whether a victim lies within the hit shape.
      Parameters:
      yaw - The projectile's yaw.
      origin - The projectile's position.
      victimPosition - The victim's position.
      victimHalfExtent - The victim's horizontal half extent, expanding the shape so victims count by their body, not their center point.
      Returns:
      true when the victim is inside the hit shape.
    • clone

      @Nonnull public Component<EntityStore> clone()
      Specified by:
      clone in interface Component<EntityStore>
      Returns:
      a clone instance of the original component instance.