Class Box
- java.lang.Object
-
- com.google.ar.sceneform.collision.CollisionShape
-
- com.google.ar.sceneform.collision.Box
-
public class Box extends CollisionShape
Mathematical representation of a box. Used to perform intersection and collision tests against oriented boxes.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Vector3
getCenter()
Get a copy of the box's center.Vector3
getExtents()
Calculate the extents (half the size) of the box.Quaternion
getRotation()
Get a copy of the box's rotation.Vector3
getSize()
Get a copy of the box's size.Box
makeCopy()
void
setCenter(Vector3 center)
Set the center of this box.void
setRotation(Quaternion rotation)
Set the rotation of this box.void
setSize(Vector3 size)
Set the size of this box.
-
-
-
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.
-
-
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)
-
makeCopy
public Box makeCopy()
- Specified by:
makeCopy
in classCollisionShape
-
-