All Superinterfaces:
BoundingBox
All Known Implementing Classes:
OBBImpl

public interface OBB extends BoundingBox
Represents an OBB, aka an Oriented Bounding Box. These are best described as a rotatable AABB. Generally speaking, OBBs are much more accurate due to their ability to rotate, but come at the cost of taking more computational power. ImmersiveMC uses this for things such as the bag's items so that they rotate cleanly with the bag.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    contains(net.minecraft.world.phys.Vec3 point)
    Whether a given point can be found inside this OBB.
    net.minecraft.world.phys.Vec3
     
    net.minecraft.world.phys.AABB
     
    org.joml.Quaternionf
    OBBs are rotated AABBs internally.
    net.minecraft.world.phys.AABB
    OBBs are rotated AABBs internally.
    Optional<net.minecraft.world.phys.Vec3>
    rayHit(net.minecraft.world.phys.Vec3 rayStart, net.minecraft.world.phys.Vec3 rayEnd)
    Where the provided ray intersects this OBB the soonest.

    Methods inherited from interface com.hammy275.immersivemc.api.common.hitbox.BoundingBox

    asAABB, asOBB, isAABB, isOBB
  • Method Details

    • contains

      boolean contains(net.minecraft.world.phys.Vec3 point)
      Whether a given point can be found inside this OBB.
      Parameters:
      point - Point to check.
      Returns:
      Whether the point is in this OBB or not.
    • rayHit

      Optional<net.minecraft.world.phys.Vec3> rayHit(net.minecraft.world.phys.Vec3 rayStart, net.minecraft.world.phys.Vec3 rayEnd)
      Where the provided ray intersects this OBB the soonest.
      Parameters:
      rayStart - Start of ray
      rayEnd - End of ray
      Returns:
      An optional containing where they ray hit this OBB, or an empty Optional if there was no hit.
    • getUnderlyingAABB

      net.minecraft.world.phys.AABB getUnderlyingAABB()
      OBBs are rotated AABBs internally. This function retrieves that internal AABB.
      Returns:
      Internal AABB
    • getCenter

      net.minecraft.world.phys.Vec3 getCenter()
      Returns:
      The center of this OBB
    • getRotation

      org.joml.Quaternionf getRotation()
      OBBs are rotated AABBs internally. This function retrieves a copy of the Quaternionf used for rotation.
      Returns:
      A copy of the internal Quaternionf.
    • getEnclosingAABB

      net.minecraft.world.phys.AABB getEnclosingAABB()
      Returns:
      A reasonably-sized AABB guaranteed to contain this OBB. Bad for collision checks, as it tends to be significantly larger than the actual OBB, but good for detecting things that should then be detected on this OBB. Note that the actual sizing of the returned AABB is NOT covered under the API beyond the fact that it is guaranteed to contain the entirety of the OBB within its bounds.