public class CompoundCollisionShape extends CollisionShape
btCompoundShape.| Modifier and Type | Field and Description |
|---|---|
static java.util.logging.Logger |
logger2
message logger for this class
|
enableContactFilter, logger, margin, scaleloggerN| Constructor and Description |
|---|
CompoundCollisionShape()
Instantiate an empty compound shape (with an initial capacity of 6,
dynamic AABB, and no children).
|
CompoundCollisionShape(int initialCapacity)
Instantiate an empty compound shape with the specified initial capacity
(and dynamic AABB and no children).
|
| Modifier and Type | Method and Description |
|---|---|
void |
addChildShape(CollisionShape childShape)
Add a child shape without transforming its coordinates.
|
void |
addChildShape(CollisionShape childShape,
float offsetX,
float offsetY,
float offsetZ)
Add a child shape with the specified local translation.
|
void |
addChildShape(CollisionShape shape,
Transform transform)
Add a child shape with the specified local transform.
|
void |
addChildShape(CollisionShape childShape,
Vector3f offset)
Add a child shape with the specified local translation.
|
void |
addChildShape(CollisionShape childShape,
Vector3f offset,
Matrix3f rotation)
Add a child shape with the specified local translation and orientation.
|
boolean |
canScale(Vector3f scale)
Test whether the specified scale factors can be applied to this shape.
|
boolean |
canSplit()
Test whether this shape can be split by an arbitrary plane.
|
boolean[][] |
connectivityMatrix(CollisionSpace space)
Generate a connectivity matrix for the children.
|
void |
correctAxes(Transform paTransform)
Apply the inverse of the specified Transform to each child shape.
|
int |
countChildren()
Count the child shapes.
|
int |
countGroups(CollisionSpace space,
int[] storeMap)
Enumerate disconnected groups of connected children.
|
int |
findIndex(CollisionShape childShape)
Find the first child with the specified shape.
|
ChildCollisionShape[] |
listChildren()
Enumerate the child shapes.
|
float |
maxRadius()
Estimate how far the shape extends from its origin.
|
Transform |
principalAxes(java.nio.FloatBuffer masses,
Transform storeTransform,
Vector3f storeInertia)
Calculates the coordinate transform to be applied to a rigid body in
order for this shape to be centered on its center of mass and its
principal axes to coincide with its local axes.
|
protected void |
recalculateAabb()
Recalculate this shape's bounding box if necessary.
|
void |
removeChildShape(CollisionShape childShape)
Remove a child CollisionShape from this shape.
|
void |
rotate(Matrix3f rotation)
Apply the specified rotation (in the parent's coordinate system) to each
child.
|
float |
scaledVolume()
Estimate the volume of this shape, including scale and margin.
|
void |
setChildTransform(CollisionShape childShape,
Transform transform)
Alter the local transform of the specified child CollisionShape.
|
void |
setScale(Vector3f scale)
Alter the scale of this shape and its children.
|
CompoundCollisionShape[] |
split(Triangle parentTriangle)
Divide this shape into 2 compound shapes.
|
CollisionShape |
toSplittableShape()
Approximate this shape with a splittable shape.
|
void |
translate(Vector3f amount)
Apply the specified translation (in the parent's coordinate system) to
each child.
|
aabbCenter, boundingBox, boundingBox, getDefaultMargin, getMargin, getScale, getScaleDp, getShapeType, getShapeType, isConcave, isContactFilterEnabled, isConvex, isInfinite, isNonMoving, isPolyhedral, nativeMargin, setContactFilterEnabled, setDefaultMargin, setMargin, setNativeId, setScale, setUserIndex, setUserIndex2, toString, updateScale, userIndex, userIndex2compareTo, countTrackers, dumpTrackers, equals, freeUnusedObjects, hasAssignedNativeObject, hashCode, nativeId, reassignNativeId, setNativeIdNotTracked, unassignNativeObjectpublic static final java.util.logging.Logger logger2
public CompoundCollisionShape()
public CompoundCollisionShape(int initialCapacity)
initialCapacity - the number of children to allocate (>0,
default=6)public void addChildShape(CollisionShape childShape)
childShape - the child shape to add (not null, not a compound shape,
alias created)public void addChildShape(CollisionShape childShape, Vector3f offset)
childShape - the child shape to add (not null, not a compound shape,
alias created)offset - the local coordinates of the child shape's origin (not
null, unaffected)public void addChildShape(CollisionShape childShape, float offsetX, float offsetY, float offsetZ)
childShape - the child shape to add (not null, not a compound shape,
alias created)offsetX - the local X coordinate of the child shape's originoffsetY - the local Y coordinate of the child shape's originoffsetZ - the local Z coordinate of the child shape's originpublic void addChildShape(CollisionShape childShape, Vector3f offset, Matrix3f rotation)
childShape - the child shape to add (not null, not a compound shape,
alias created)offset - the local coordinates of the child shape's origin (not
null, unaffected)rotation - the local orientation of the child shape (not null,
unaffected)public void addChildShape(CollisionShape shape, Transform transform)
shape - the child shape to add (not null, not a compound shape,
alias created)transform - the local transform of the child shape (not null,
unaffected)public boolean[][] connectivityMatrix(CollisionSpace space)
space - the space to use for tests, or null to create a new spacepublic void correctAxes(Transform paTransform)
paTransform - the Transform to un-apply, typically one obtained
using principalAxes(java.nio.FloatBuffer,
com.jme3.math.Transform, com.jme3.math.Vector3f) (not null, unaffected,
scale=1)public int countChildren()
public int countGroups(CollisionSpace space, int[] storeMap)
A graph-coloring algorithm is applied to the connectivity matrix. Each node in the graph represents a child, and each color represents a group of connected children.
space - the space to use for tests, or null to create a new spacestoreMap - storage for the mapping from children to groups (not
null, length = number of children, modified)public int findIndex(CollisionShape childShape)
childShape - the shape to search for (unaffected)public ChildCollisionShape[] listChildren()
public Transform principalAxes(java.nio.FloatBuffer masses, Transform storeTransform, Vector3f storeInertia)
correctAxes(com.jme3.math.Transform). The resulting moment of
inertia is also calculated.masses - the relative mass for each child shape (not null, direct,
all elements >0)storeTransform - storage for the transform (modified if not null)storeInertia - storage for the moment of inertia (not null,
modified)public void removeChildShape(CollisionShape childShape)
childShape - the collision shape to remove (not null)public void rotate(Matrix3f rotation)
rotation - the rotation to apply (not null, unaffected)public void setChildTransform(CollisionShape childShape, Transform transform)
childShape - the child's CollisionShape (not null, unaffected)transform - the desired Transform (not null, unaffected)public CompoundCollisionShape[] split(Triangle parentTriangle)
parentTriangle - a triangle that defines the splitting plane (in the
parent's shape coordinates, not null, unaffected)public void translate(Vector3f amount)
amount - the translation to apply (not null, unaffected)public boolean canScale(Vector3f scale)
canScale in class CollisionShapescale - the desired scale factor for each local axis (may be null,
unaffected)public boolean canSplit()
canSplit in class CollisionShapepublic float maxRadius()
maxRadius in class CollisionShapeprotected void recalculateAabb()
recalculateAabb in class CollisionShapepublic float scaledVolume()
scaledVolume in class CollisionShapepublic void setScale(Vector3f scale)
Note that if shapes are shared (between collision objects and/or compound shapes) changes can have unintended consequences.
setScale in class CollisionShapescale - the desired scale factor for each local axis (not null, no
negative component, unaffected, default=(1,1,1))public CollisionShape toSplittableShape()
toSplittableShape in class CollisionShape