public class RagdollUtils
extends java.lang.Object
This class is shared between JBullet and Native Bullet.
| Modifier and Type | Method and Description | 
|---|---|
| static java.util.Map<java.lang.Integer,java.util.List<java.lang.Float>> | buildPointMap(Spatial model)Build a map of mesh vertices in a subtree of the scene graph. | 
| static java.util.List<java.lang.Integer> | getBoneIndices(Bone bone,
              Skeleton skeleton,
              java.util.Set<java.lang.String> boneList)Enumerate the bone indices of the specified bone and all its descendents. | 
| static boolean | hasVertices(int boneIndex,
           Mesh[] targets,
           float weightThreshold)Test whether the indexed bone has at least one vertex in the specified
 meshes with a weight greater than the specified threshold. | 
| static HullCollisionShape | makeShapeFromPointMap(java.util.Map<java.lang.Integer,java.util.List<java.lang.Float>> pointsMap,
                     java.util.List<java.lang.Integer> boneIndices,
                     Vector3f initialScale,
                     Vector3f initialPosition)Create a hull collision shape from linked vertices to this bone. | 
| static HullCollisionShape | makeShapeFromVerticeWeights(Spatial model,
                           java.util.List<java.lang.Integer> boneIndices,
                           Vector3f initialScale,
                           Vector3f initialPosition,
                           float weightThreshold)Create a hull collision shape from linked vertices to this bone. | 
| static int | readIndex(java.nio.Buffer buffer,
         int k)Read an index from a buffer. | 
| static void | setJointLimit(SixDofJoint joint,
             float maxX,
             float minX,
             float maxY,
             float minY,
             float maxZ,
             float minZ)Alter the limits of the specified 6-DOF joint. | 
| static void | setTransform(Bone bone,
            Vector3f pos,
            Quaternion rot,
            boolean restoreBoneControl,
            java.util.Set<java.lang.String> boneList)Updates a bone position and rotation. | 
| static void | setUserControl(Bone bone,
              boolean bool)Alter the user-control flags of a bone and all its descendents. | 
public static void setJointLimit(SixDofJoint joint, float maxX, float minX, float maxY, float minY, float maxZ, float minZ)
joint - which joint to alter (not null)maxX - the maximum rotation on the X axis (in radians)minX - the minimum rotation on the X axis (in radians)maxY - the maximum rotation on the Y axis (in radians)minY - the minimum rotation on the Y axis (in radians)maxZ - the maximum rotation on the Z axis (in radians)minZ - the minimum rotation on the Z axis (in radians)public static java.util.Map<java.lang.Integer,java.util.List<java.lang.Float>> buildPointMap(Spatial model)
model - the root of the subtree (may be null)public static HullCollisionShape makeShapeFromPointMap(java.util.Map<java.lang.Integer,java.util.List<java.lang.Float>> pointsMap, java.util.List<java.lang.Integer> boneIndices, Vector3f initialScale, Vector3f initialPosition)
pointsMap - map from bone indices to coordinates (not null,
 unaffected)boneIndices - (not null, unaffected)initialScale - scale factors (not null, unaffected)initialPosition - location (not null, unaffected)public static java.util.List<java.lang.Integer> getBoneIndices(Bone bone, Skeleton skeleton, java.util.Set<java.lang.String> boneList)
bone - the input bone (not null)skeleton - the skeleton containing the bone (not null)boneList - a set of bone names (not null, unaffected)public static HullCollisionShape makeShapeFromVerticeWeights(Spatial model, java.util.List<java.lang.Integer> boneIndices, Vector3f initialScale, Vector3f initialPosition, float weightThreshold)
model - the model on which to base the shapeboneIndices - indices of relevant bones (not null, unaffected)initialScale - scale factorsinitialPosition - locationweightThreshold - minimum weight for inclusionpublic static void setTransform(Bone bone, Vector3f pos, Quaternion rot, boolean restoreBoneControl, java.util.Set<java.lang.String> boneList)
bone - the bonepos - the positionrot - the rotationrestoreBoneControl - true → user-control flag should be setboneList - the names of all bones without collision shapes (not
 null, unaffected)public static void setUserControl(Bone bone, boolean bool)
bone - the ancestor bone (not null, modified)bool - true to enable user control, false to disablepublic static boolean hasVertices(int boneIndex,
                                  Mesh[] targets,
                                  float weightThreshold)
boneIndex - the index of the bone (≥0)targets - the meshes to search (not null, no null elements)weightThreshold - the threshold (≥0, ≤1)public static int readIndex(java.nio.Buffer buffer,
                            int k)
buffer - a buffer of bytes or shorts (not null)k - the position from which the index will be read