Package jme3utilities.wes
Class SupportUtils
java.lang.Object
jme3utilities.wes.SupportUtils
Utility methods used to translate an animated C-G model for support or
traction.
-
Method Summary
Modifier and TypeMethodDescriptionstatic intfindSupport(com.jme3.scene.Geometry geometry, com.jme3.math.Matrix4f[] skinningMatrices, com.jme3.math.Vector3f storeLocation) Find the point of vertical support (minimum Y coordinate) for the specified geometry transformed by the specified skinning matrices.static intfindSupport(com.jme3.scene.Spatial subtree, com.jme3.math.Matrix4f[] skinningMatrices, com.jme3.math.Vector3f storeLocation, com.jme3.scene.Geometry[] storeGeometry) Find the point of vertical support (minimum Y coordinate) for the meshes in the specified subtree, each transformed by the specified skinning matrices.static com.jme3.math.Matrix3fsensitivity(int boneIndex, com.jme3.scene.Geometry geometry, int vertexIndex, Pose pose, com.jme3.math.Matrix3f storeResult) Calculate the sensitivity of the indexed vertex to translations of the indexed Bone in the specified pose.static com.jme3.math.Vector3f[]translateForInitialSupport(com.jme3.anim.AnimClip oldClip, int jointIndex, com.jme3.anim.Armature armature, com.jme3.scene.Spatial subtree, float supportY) Calculate translations of the specified joint to put the point of support initially at the specified Y-coordinate.static com.jme3.math.Vector3f[]translateForSupport(com.jme3.anim.AnimClip oldClip, int jointIndex, com.jme3.anim.Armature armature, com.jme3.scene.Spatial subtree, float supportY) Calculate translations of the specified joint to keep the point of support at the specified Y-coordinate.static com.jme3.math.Vector3f[]translateForTraction(com.jme3.anim.AnimClip oldClip, int jointIndex, com.jme3.anim.Armature armature, com.jme3.scene.Spatial subtree) Calculate translations of the specified joint to simulate traction at the point of support.
-
Method Details
-
findSupport
public static int findSupport(com.jme3.scene.Geometry geometry, com.jme3.math.Matrix4f[] skinningMatrices, com.jme3.math.Vector3f storeLocation) Find the point of vertical support (minimum Y coordinate) for the specified geometry transformed by the specified skinning matrices.- Parameters:
geometry- (not null)skinningMatrices- (not null, unaffected)storeLocation- point in world coordinates (not null, modified)- Returns:
- index of vertex in the geometry's mesh (≥0) or -1 if none found
-
findSupport
public static int findSupport(com.jme3.scene.Spatial subtree, com.jme3.math.Matrix4f[] skinningMatrices, com.jme3.math.Vector3f storeLocation, com.jme3.scene.Geometry[] storeGeometry) Find the point of vertical support (minimum Y coordinate) for the meshes in the specified subtree, each transformed by the specified skinning matrices.- Parameters:
subtree- (may be null)skinningMatrices- (not null, unaffected)storeLocation- point in world coordinates (not null, modified)storeGeometry- (not null, modified)- Returns:
- index of vertex in storeGeometry's mesh (≥0) or -1 if none found
-
sensitivity
public static com.jme3.math.Matrix3f sensitivity(int boneIndex, com.jme3.scene.Geometry geometry, int vertexIndex, Pose pose, com.jme3.math.Matrix3f storeResult) Calculate the sensitivity of the indexed vertex to translations of the indexed Bone in the specified pose.- Parameters:
boneIndex- which bone to translate (≥0)geometry- (not null)vertexIndex- index into the geometry's vertices (≥0)pose- (not null, unaffected)storeResult- storage for the result (modified if not null)- Returns:
- the sensitivity matrix (either storeResult or a new instance)
-
translateForInitialSupport
public static com.jme3.math.Vector3f[] translateForInitialSupport(com.jme3.anim.AnimClip oldClip, int jointIndex, com.jme3.anim.Armature armature, com.jme3.scene.Spatial subtree, float supportY) Calculate translations of the specified joint to put the point of support initially at the specified Y-coordinate.- Parameters:
oldClip- the clip to be replaced (not null, unaffected)jointIndex- the index of the target joint (≥0)armature- the Armature of the model (not null, unaffected)subtree- the scene-graph subtree containing all vertices to consider (not null, unaffected)supportY- world Y-coordinate for support- Returns:
- a new array of translation vectors or
nullif unsuccessful
-
translateForSupport
public static com.jme3.math.Vector3f[] translateForSupport(com.jme3.anim.AnimClip oldClip, int jointIndex, com.jme3.anim.Armature armature, com.jme3.scene.Spatial subtree, float supportY) Calculate translations of the specified joint to keep the point of support at the specified Y-coordinate.- Parameters:
oldClip- the clip to be replaced (not null, unaffected)jointIndex- the index of the target joint (≥0)armature- the Armature of the model (not null, unaffected)subtree- the scene-graph subtree containing all vertices to consider (not null, unaffected)supportY- world Y-coordinate for support- Returns:
- a new array of translation vectors or
nullif unsuccessful
-
translateForTraction
public static com.jme3.math.Vector3f[] translateForTraction(com.jme3.anim.AnimClip oldClip, int jointIndex, com.jme3.anim.Armature armature, com.jme3.scene.Spatial subtree) Calculate translations of the specified joint to simulate traction at the point of support.- Parameters:
oldClip- the clip to be replaced (not null, unaffected)jointIndex- the index of the target joint (≥0)armature- the Armature of the model (not null, unaffected)subtree- the scene-graph subtree containing all vertices to consider (not null, unaffected)- Returns:
- a new array of translation vectors or
nullif unsuccessful
-