Class AxisAlignedBoxCollider

java.lang.Object
rosequartz.coll.Collider
rosequartz.coll.AxisAlignedBoxCollider
All Implemented Interfaces:
Serializable

public final class AxisAlignedBoxCollider extends Collider implements Serializable
Represents a collider in the shape of an axis-aligned box. This means that all sides of the box are parallel to the x,y or z-axis.
See Also:
Serialized Form
  • Constructor Details

    • AxisAlignedBoxCollider

      public AxisAlignedBoxCollider(float x1, float y1, float z1, float x2, float y2, float z2)
      Constructs an axis-aligned box-collider from two corner positions of the box (on opposite sides)
      Parameters:
      x1 - position of the first corner on the x-axis
      y1 - position of the first corner on the y-axis
      z1 - position of the first corner on the z-axis
      x2 - position of the second corner on the x-axis
      y2 - position of the second corner on the y-axis
      z2 - position of the second corner on the z-axis
    • AxisAlignedBoxCollider

      public AxisAlignedBoxCollider(Vec3 pos1, Vec3 pos2)
      Constructs an axis-aligned box-collider from two corner positions of the box (on opposite sides)
      Parameters:
      pos1 - position of the first corner
      pos2 - position of the second corner
  • Method Details

    • setPoint1

      public AxisAlignedBoxCollider setPoint1(float x, float y, float z)
      Sets the first of the two corner positions of the box.
      Parameters:
      x - position of the corner on the x-axis
      y - position of the corner on the y-axis
      z - position of the corner on the z-axis
      Returns:
      this
    • setPoint1

      public AxisAlignedBoxCollider setPoint1(Vec3 xyz)
      Sets the first of the two corner positions of the box.
      Parameters:
      xyz - position of the corner
      Returns:
      this
    • setPoint2

      public AxisAlignedBoxCollider setPoint2(float x, float y, float z)
      Sets the second of the two corner positions of the box.
      Parameters:
      x - position of the corner on the x-axis
      y - position of the corner on the y-axis
      z - position of the corner on the z-axis
      Returns:
      this
    • setPoint2

      public AxisAlignedBoxCollider setPoint2(Vec3 xyz)
      Sets the second of the two corner positions of the box.
      Parameters:
      xyz - position of the corner
      Returns:
      this
    • setPoints

      public AxisAlignedBoxCollider setPoints(float x1, float y1, float z1, float x2, float y2, float z2)
      Sets both corner positions of the box.
      Parameters:
      x1 - position of the first corner on the x-axis
      y1 - position of the first corner on the y-axis
      z1 - position of the first corner on the z-axis
      x2 - position of the second corner on the x-axis
      y2 - position of the second corner on the y-axis
      z2 - position of the second corner on the z-axis
      Returns:
      this
    • setPoints

      public AxisAlignedBoxCollider setPoints(Vec3 p1, Vec3 p2)
      Sets both corner positions of the box.
      Parameters:
      p1 - position of the first corner
      p2 - position of the second corner
      Returns:
      this
    • getCenterX

      public float getCenterX()
    • getCenterY

      public float getCenterY()
    • getCenterZ

      public float getCenterZ()
    • toString

      public String toString()
      Overrides:
      toString in class Object