Class Box


  • public class Box
    extends CollisionShape
    Mathematical representation of a box. Used to perform intersection and collision tests against oriented boxes.
    • Constructor Detail

      • Box

        public Box()
        Create a box with a center of (0,0,0) and a size of (1,1,1).
      • Box

        public Box​(Vector3 size)
        Create a box with a center of (0,0,0) and a specified size.
        Parameters:
        size - the size of the box.
      • Box

        public Box​(Vector3 size,
                   Vector3 center)
        Create a box with a specified center and size.
        Parameters:
        size - the size of the box
        center - the center of the box
    • Method Detail

      • setCenter

        public void setCenter​(Vector3 center)
        Set the center of this box.
        Parameters:
        center - the new center of the box
        See Also:
        getCenter()
      • getCenter

        public Vector3 getCenter()
        Get a copy of the box's center.
        Returns:
        a new vector that represents the box's center
        See Also:
        setCenter(Vector3)
      • setSize

        public void setSize​(Vector3 size)
        Set the size of this box.
        Parameters:
        size - the new size of the box
        See Also:
        getSize()
      • getSize

        public Vector3 getSize()
        Get a copy of the box's size.
        Returns:
        a new vector that represents the box's size
        See Also:
        setSize(Vector3)
      • getExtents

        public Vector3 getExtents()
        Calculate the extents (half the size) of the box.
        Returns:
        a new vector that represents the box's extents
      • setRotation

        public void setRotation​(Quaternion rotation)
        Set the rotation of this box.
        Parameters:
        rotation - the new rotation of the box
        See Also:
        getRotation()
      • getRotation

        public Quaternion getRotation()
        Get a copy of the box's rotation.
        Returns:
        a new quaternion that represents the box's rotation
        See Also:
        setRotation(Quaternion)