Class ChildCollisionShape
java.lang.Object
com.jme3.bullet.collision.shapes.infos.ChildCollisionShape
- All Implemented Interfaces:
com.jme3.export.Savable,com.jme3.util.clone.JmeCloneable,Cloneable
public class ChildCollisionShape
extends Object
implements com.jme3.util.clone.JmeCloneable, com.jme3.export.Savable
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 Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedNo-argument constructor needed by SavableClassUtil.ChildCollisionShape(com.jme3.math.Vector3f offset, CollisionShape shape) Instantiate a child without any rotation.ChildCollisionShape(com.jme3.math.Vector3f offset, com.jme3.math.Matrix3f rotation, CollisionShape shape) Instantiate a child for use in a compound shape. -
Method Summary
Modifier and TypeMethodDescriptionvoidcloneFields(com.jme3.util.clone.Cloner cloner, Object original) Callback fromClonerto convert this shallow-cloned element into a deep-cloned one, using the specified Cloner and original to resolve copied fields.com.jme3.math.Vector3fcopyOffset(com.jme3.math.Vector3f storeResult) Copy the translation in the parent's coordinate system.com.jme3.math.QuaternioncopyRotation(com.jme3.math.Quaternion storeResult) Copy the rotation in the parent's coordinate system.com.jme3.math.Matrix3fcopyRotationMatrix(com.jme3.math.Matrix3f storeResult) Copy the rotation in the parent's coordinate system.com.jme3.math.TransformcopyTransform(com.jme3.math.Transform storeResult) Copy the Transform relative to the parent's coordinate system.getShape()Access the base shape.jmeClone()Create a shallow clone for the JME cloner.voidread(com.jme3.export.JmeImporter importer) De-serialize this child from the specified importer, for example when loading from a J3O file.voidsetTransform(com.jme3.math.Vector3f offset, com.jme3.math.Matrix3f rotation) Alter the child's coordinate transform copy.split(com.jme3.math.Triangle parentTriangle) Attempt to divide this child into 2 children.voidwrite(com.jme3.export.JmeExporter exporter) Serialize this child to the specified exporter, for example when saving to a J3O file.
-
Field Details
-
logger
message logger for this class
-
-
Constructor Details
-
ChildCollisionShape
protected ChildCollisionShape()No-argument constructor needed by SavableClassUtil. -
ChildCollisionShape
public ChildCollisionShape(com.jme3.math.Vector3f offset, com.jme3.math.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
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 com.jme3.math.Vector3f copyOffset(com.jme3.math.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 com.jme3.math.Quaternion copyRotation(com.jme3.math.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 com.jme3.math.Matrix3f copyRotationMatrix(com.jme3.math.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 com.jme3.math.Transform copyTransform(com.jme3.math.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
Access the base shape.- Returns:
- the pre-existing shape (not null)
-
setTransform
public void setTransform(com.jme3.math.Vector3f offset, com.jme3.math.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
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
-
cloneFields
Callback fromClonerto convert this shallow-cloned element into a deep-cloned one, using the specified Cloner and original to resolve copied fields.- Specified by:
cloneFieldsin interfacecom.jme3.util.clone.JmeCloneable- Parameters:
cloner- the Cloner that's cloning this element (not null)original- the instance from which this element was shallow-cloned (unused)
-
jmeClone
Create a shallow clone for the JME cloner.- Specified by:
jmeClonein interfacecom.jme3.util.clone.JmeCloneable- Returns:
- a new instance
-
read
De-serialize this child from the specified importer, for example when loading from a J3O file.- Specified by:
readin interfacecom.jme3.export.Savable- Parameters:
importer- (not null)- Throws:
IOException- from the importer
-
write
Serialize this child to the specified exporter, for example when saving to a J3O file.- Specified by:
writein interfacecom.jme3.export.Savable- Parameters:
exporter- (not null)- Throws:
IOException- from the exporter
-