Package jme3utilities.minie
Class MyShape
java.lang.Object
jme3utilities.minie.MyShape
Utility methods for physics collision shapes. All methods should be static.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
describeType
(CollisionShape shape) Describe the type of the specified shape.static com.jme3.math.Vector3f
halfExtents
(CollisionShape shape, com.jme3.math.Vector3f storeResult) Determine the unscaled half extents of the specified shape.static float
height
(CollisionShape shape) Determine the unscaled height of the specified shape.static float[]
Estimate the volume of each child in a CompoundCollisionShape.static int
mainAxisIndex
(CollisionShape shape) Determine the main axis of the specified shape, provided it's a capsule, cone, or cylinder.static long
parseNativeId
(String string) Parse the native ID of a shape from its String representation.static float
radius
(CollisionShape shape) Determine the unscaled radius of the specified shape.static CollisionShape
setHalfExtents
(CollisionShape oldShape, com.jme3.math.Vector3f newHalfExtents) Copy a shape, altering only its half extents.static CollisionShape
setHeight
(CollisionShape oldShape, float newHeight) Copy a shape, altering only its height.static CollisionShape
setRadius
(CollisionShape oldShape, float newRadius) Copy a shape, altering only its radius.static float
volume
(CollisionShape shape) Estimate the scaled volume of a closed shape.
-
Field Details
-
logger
message logger for this class
-
-
Method Details
-
describeType
Describe the type of the specified shape.- Parameters:
shape
- the shape to describe (not null, unaffected)- Returns:
- the type description (not null)
-
halfExtents
public static com.jme3.math.Vector3f halfExtents(CollisionShape shape, com.jme3.math.Vector3f storeResult) Determine the unscaled half extents of the specified shape.- Parameters:
shape
- (not null, unaffected)storeResult
- storage for the result (modified if not null)- Returns:
- a vector with all components non-negative (either storeResult or a new instance)
-
height
Determine the unscaled height of the specified shape.- Parameters:
shape
- (not null, unaffected)- Returns:
- the unscaled height (≥0) used to create the shape, or NaN if that height is undefined or unknown
-
listVolumes
Estimate the volume of each child in a CompoundCollisionShape.- Parameters:
shape
- (not null, unaffected)- Returns:
- a new array of volumes (each ≥0)
-
mainAxisIndex
Determine the main axis of the specified shape, provided it's a capsule, cone, or cylinder.- Parameters:
shape
- (may be null, unaffected)- Returns:
- 0→X, 1→Y, 2→Z, -1→doesn't have a main axis
-
parseNativeId
Parse the native ID of a shape from its String representation.- Parameters:
string
- the input text (not null, exactly one "#")- Returns:
- the shape's ID
- See Also:
-
radius
Determine the unscaled radius of the specified shape.- Parameters:
shape
- (not null, unaffected)- Returns:
- the unscaled radius (≥0) used to create the shape, or NaN if that radius is undefined or unknown
-
setHalfExtents
public static CollisionShape setHalfExtents(CollisionShape oldShape, com.jme3.math.Vector3f newHalfExtents) Copy a shape, altering only its half extents.- Parameters:
oldShape
- input shape (not null, unaffected)newHalfExtents
- (not null, no negative component, unaffected)- Returns:
- a new shape, or null if not possible
-
setHeight
Copy a shape, altering only its height.- Parameters:
oldShape
- input shape (not null, unaffected)newHeight
- the desired unscaled height (≥0)- Returns:
- a new shape
-
setRadius
Copy a shape, altering only its radius.- Parameters:
oldShape
- input shape (not null, unaffected)newRadius
- the desired unscaled radius (≥0)- Returns:
- a new shape
-
volume
Estimate the scaled volume of a closed shape.- Parameters:
shape
- (not null, unaffected)- Returns:
- the volume (in physics-space units cubed, ≥0)
-