Package com.jme3.bullet.collision.shapes
Class CustomConvexShape
java.lang.Object
com.jme3.bullet.NativePhysicsObject
com.jme3.bullet.collision.shapes.CollisionShape
com.jme3.bullet.collision.shapes.ConvexShape
com.jme3.bullet.collision.shapes.CustomConvexShape
- All Implemented Interfaces:
com.jme3.export.Savable,com.jme3.util.clone.JmeCloneable,Cloneable,Comparable<NativePhysicsObject>
An abstract base class for collision shapes defined in terms of their
supporting vertices, based on Bullet's
btConvexInternalShape.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Loggermessage logger for this classprotected static final ThreadLocal<com.jme3.math.Vector3f> temporary storage for one vector per threadFields inherited from class com.jme3.bullet.collision.shapes.ConvexShape
loggerXFields inherited from class com.jme3.bullet.collision.shapes.CollisionShape
enableContactFilter, logger, margin, scaleFields inherited from class com.jme3.bullet.NativePhysicsObject
loggerN -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedNo-argument constructor needed by SavableClassUtil.protectedCustomConvexShape(float xHalfExtent, float yHalfExtent, float zHalfExtent) Instantiate a custom collision shape with the specified extents.protectedCustomConvexShape(com.jme3.math.Vector3f halfExtents) Instantiate a custom collision shape with the specified extents. -
Method Summary
Modifier and TypeMethodDescriptionvoidcloneFields(com.jme3.util.clone.Cloner cloner, Object original) Callback fromClonerto convert this shallow-cloned shape into a deep-cloned one, using the specified Cloner and original to resolve copied fields.protected abstract com.jme3.math.Vector3flocateSupport(float dirX, float dirY, float dirZ) Locate the shape's supporting vertex for the specified normal direction, excluding collision margin.voidread(com.jme3.export.JmeImporter importer) De-serialize the shape from the specified importer, for example when loading from a J3O file.protected voidsetScaledInertia(float ix, float iy, float iz) Alter the scaled rotational inertia.voidwrite(com.jme3.export.JmeExporter exporter) Serialize this shape to the specified exporter, for example when saving to a J3O file.Methods inherited from class com.jme3.bullet.collision.shapes.ConvexShape
isConcave, isConvex, scaledVolume, toHullShape, toSplittableShapeMethods inherited from class com.jme3.bullet.collision.shapes.CollisionShape
aabbCenter, aabbScaledVolume, boundingBox, boundingBox, canScale, canSplit, copyShapeProperties, getDefaultMargin, getMargin, getScale, getScaleDp, getShapeType, getShapeType, isContactFilterEnabled, isInfinite, isNonMoving, isPolyhedral, jmeClone, maxRadius, nativeMargin, readShapeProperties, recalculateAabb, setContactFilterEnabled, setDefaultMargin, setMargin, setNativeId, setScale, setScale, setUserIndex, setUserIndex2, toString, updateScale, userIndex, userIndex2Methods inherited from class com.jme3.bullet.NativePhysicsObject
compareTo, countTrackers, dumpTrackers, equals, freeUnusedObjects, hasAssignedNativeObject, hashCode, nativeId, reassignNativeId, setNativeIdNotTracked, unassignNativeObject
-
Field Details
-
loggerY
message logger for this class -
threadTmpVector
temporary storage for one vector per thread
-
-
Constructor Details
-
CustomConvexShape
protected CustomConvexShape()No-argument constructor needed by SavableClassUtil. -
CustomConvexShape
protected CustomConvexShape(float xHalfExtent, float yHalfExtent, float zHalfExtent) Instantiate a custom collision shape with the specified extents. Subclass constructors should also invokesetScaledInertia().- Parameters:
xHalfExtent- the desired half extent on the local X axis, for scale=(1,1,1) and margin=0 (>0)yHalfExtent- the desired half extent on the local Y axis, for scale=(1,1,1) and margin=0 (>0)zHalfExtent- the desired half extent on the local Z axis, for scale=(1,1,1) and margin=0 (>0)
-
CustomConvexShape
protected CustomConvexShape(com.jme3.math.Vector3f halfExtents) Instantiate a custom collision shape with the specified extents. Subclass constructors should also invokesetScaledInertia().- Parameters:
halfExtents- the desired half extents on each local axis, for scale=(1,1,1) and margin=0 (all components >0, unaffected), ornullto calculate AABBs using the supporting vertices
-
-
Method Details
-
locateSupport
protected abstract com.jme3.math.Vector3f locateSupport(float dirX, float dirY, float dirZ) Locate the shape's supporting vertex for the specified normal direction, excluding collision margin.This method is invoked by native code.
- Parameters:
dirX- the X-coordinate of the direction to test (in scaled shape coordinates)dirY- the Y-coordinate of the direction to test (in scaled shape coordinates)dirZ- the Z-coordinate of the direction to test (in scaled shape coordinates)- Returns:
- the location on the shape's surface with the specified normal (in scaled shape coordinates, must lie on or within the shape's bounding box)
-
setScaledInertia
protected void setScaledInertia(float ix, float iy, float iz) Alter the scaled rotational inertia. Typically invoked during instantiation or after a change of scale.- Parameters:
ix- the desired X-axis rotational inertia for mass=1 (>0)iy- the desired Y-axis rotational inertia for mass=1 (>0)iz- the desired Z-axis rotational inertia for mass=1 (>0)
-
cloneFields
Callback fromClonerto convert this shallow-cloned shape into a deep-cloned one, using the specified Cloner and original to resolve copied fields.- Specified by:
cloneFieldsin interfacecom.jme3.util.clone.JmeCloneable- Overrides:
cloneFieldsin classCollisionShape- Parameters:
cloner- the Cloner that's cloning this shape (not null)original- the instance from which this shape was shallow-cloned (not null, unaffected)
-
read
De-serialize the shape from the specified importer, for example when loading from a J3O file.- Specified by:
readin interfacecom.jme3.export.Savable- Overrides:
readin classCollisionShape- Parameters:
importer- (not null)- Throws:
IOException- from the importer
-
write
Serialize this shape to the specified exporter, for example when saving to a J3O file.- Specified by:
writein interfacecom.jme3.export.Savable- Overrides:
writein classCollisionShape- Parameters:
exporter- (not null)- Throws:
IOException- from the exporter
-