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:
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<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
CustomConvexShape
(float xHalfExtent, float yHalfExtent, float zHalfExtent) Instantiate a custom collision shape with the specified extents.protected
CustomConvexShape
(Vector3f halfExtents) Instantiate a custom collision shape with the specified extents. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract Vector3f
locateSupport
(float dirX, float dirY, float dirZ) Locate the shape's supporting vertex for the specified normal direction, excluding collision margin.protected void
setScaledInertia
(float ix, float iy, float iz) Alter the scaled rotational inertia.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, boundingBox, boundingBox, canScale, canSplit, getDefaultMargin, getMargin, getScale, getScaleDp, getShapeType, getShapeType, isContactFilterEnabled, isInfinite, isNonMoving, isPolyhedral, maxRadius, nativeMargin, 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(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
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
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)
-