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
Modifier and TypeFieldDescriptionstatic final Logger
message 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
loggerX
Fields inherited from class com.jme3.bullet.collision.shapes.CollisionShape
enableContactFilter, logger, margin, scale
Fields inherited from class com.jme3.bullet.NativePhysicsObject
loggerN
-
Constructor Summary
ModifierConstructorDescriptionprotected
No-argument constructor needed by SavableClassUtil.protected
CustomConvexShape
(float xHalfExtent, float yHalfExtent, float zHalfExtent) Instantiate a custom collision shape with the specified extents.protected
CustomConvexShape
(com.jme3.math.Vector3f halfExtents) Instantiate a custom collision shape with the specified extents. -
Method Summary
Modifier and TypeMethodDescriptionvoid
cloneFields
(com.jme3.util.clone.Cloner cloner, Object original) Callback fromCloner
to 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.Vector3f
locateSupport
(float dirX, float dirY, float dirZ) Locate the shape's supporting vertex for the specified normal direction, excluding collision margin.void
read
(com.jme3.export.JmeImporter importer) De-serialize the shape from the specified importer, for example when loading from a J3O file.protected void
setScaledInertia
(float ix, float iy, float iz) Alter the scaled rotational inertia.void
write
(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, toSplittableShape
Methods 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, userIndex2
Methods 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), ornull
to 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 fromCloner
to convert this shallow-cloned shape into a deep-cloned one, using the specified Cloner and original to resolve copied fields.- Specified by:
cloneFields
in interfacecom.jme3.util.clone.JmeCloneable
- Overrides:
cloneFields
in 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:
read
in interfacecom.jme3.export.Savable
- Overrides:
read
in 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:
write
in interfacecom.jme3.export.Savable
- Overrides:
write
in classCollisionShape
- Parameters:
exporter
- (not null)- Throws:
IOException
- from the exporter
-