Contents
Class DirectionalHitBox
java.lang.Object
com.hypixel.hytale.server.core.modules.projectile.component.DirectionalHitBox
- All Implemented Interfaces:
Component<EntityStore>, Cloneable
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.
-
Field Summary
Fields inherited from interface Component
EMPTY_ARRAY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()booleancontains(float yaw, org.joml.Vector3d origin, org.joml.Vector3d victimPosition, double victimHalfExtent) Tests whether a victim lies within the hit shape.static ComponentType<EntityStore, DirectionalHitBox> Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Component
cloneSerializable
-
Constructor Details
-
DirectionalHitBox
public DirectionalHitBox(double halfWidth, double halfDepth)
-
-
Method Details
-
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:
truewhen the victim is inside the hit shape.
-
clone
- Specified by:
clonein interfaceComponent<EntityStore>- Returns:
- a clone instance of the original component instance.
-