Class ChildCollisionShape

java.lang.Object
com.jme3.bullet.collision.shapes.infos.ChildCollisionShape

public class ChildCollisionShape extends Object
An element in a CompoundCollisionShape, consisting of a (non-compound) base shape, offset and rotated with respect to its parent.

Despite its name, it is not a subtype of CollisionShape!

  • Field Details

    • logger

      public static final Logger logger
      message logger for this class
  • Constructor Details

    • ChildCollisionShape

      public ChildCollisionShape(Vector3f offset, Matrix3f rotation, CollisionShape shape)
      Instantiate a child for use in a compound shape.
      Parameters:
      offset - the desired translation in the parent's coordinate system (not null, unaffected)
      rotation - the desired rotation in the parent's coordinate system (not null, unaffected)
      shape - the base shape (not null, not a compound shape, alias created)
    • ChildCollisionShape

      public ChildCollisionShape(Vector3f offset, CollisionShape shape)
      Instantiate a child without any rotation.
      Parameters:
      offset - the desired translation in the parent's coordinate system (not null, unaffected)
      shape - the base shape (not null, not a compound shape, alias created)
  • Method Details

    • copyOffset

      public Vector3f copyOffset(Vector3f storeResult)
      Copy the translation in the parent's coordinate system.
      Parameters:
      storeResult - storage for the result (modified if not null)
      Returns:
      a translation vector (either storeResult or a new vector, not null)
    • copyRotation

      public Quaternion copyRotation(Quaternion storeResult)
      Copy the rotation in the parent's coordinate system.
      Parameters:
      storeResult - storage for the result (modified if not null)
      Returns:
      a Quaternion (either storeResult or a new Quaternion, not null)
    • copyRotationMatrix

      public Matrix3f copyRotationMatrix(Matrix3f storeResult)
      Copy the rotation in the parent's coordinate system.
      Parameters:
      storeResult - storage for the result (modified if not null)
      Returns:
      a rotation matrix (either storeResult or a new matrix, not null)
    • copyTransform

      public Transform copyTransform(Transform storeResult)
      Copy the Transform relative to the parent's coordinate system.
      Parameters:
      storeResult - storage for the result (modified if not null)
      Returns:
      a Transform with scale=1 (either storeResult or a new instance, not null)
    • getShape

      public CollisionShape getShape()
      Access the base shape.
      Returns:
      the pre-existing shape (not null)
    • setTransform

      public void setTransform(Vector3f offset, Matrix3f rotation)
      Alter the child's coordinate transform copy. For internal use only.
      Parameters:
      offset - the desired translation relative to the parent (not null, unaffected)
      rotation - the desired rotation relative to the parent (not null, unaffected)
      See Also:
    • split

      public ChildCollisionShape[] split(Triangle parentTriangle)
      Attempt to divide this child into 2 children. The base shape must be splittable.
      Parameters:
      parentTriangle - a triangle that defines the splitting plane (in parent's shape coordinates, not null, unaffected)
      Returns:
      a pair of children, the first element on the triangle's minus side and the 2nd element on its plus side; either element may be null, indicating an empty child