本文整理汇总了Java中com.jme3.bullet.joints.SixDofJoint类的典型用法代码示例。如果您正苦于以下问题:Java SixDofJoint类的具体用法?Java SixDofJoint怎么用?Java SixDofJoint使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SixDofJoint类属于com.jme3.bullet.joints包,在下文中一共展示了SixDofJoint类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setupJointForBone
import com.jme3.bullet.joints.SixDofJoint; //导入依赖的package包/类
public void setupJointForBone(String boneName, SixDofJoint joint) {
if (boneMap.isEmpty()) {
initBoneMap();
}
if (lexicon.isEmpty()) {
initLexicon();
}
String resultName = "";
int resultScore = 0;
for (String key : lexicon.keySet()) {
int score = lexicon.get(key).getScore(boneName);
if (score > resultScore) {
resultScore = score;
resultName = key;
}
}
JointPreset preset = boneMap.get(resultName);
if (preset != null && resultScore >= 50) {
logger.log(Level.INFO, "Found matching joint for bone {0} : {1} with score {2}", new Object[]{boneName, resultName, resultScore});
preset.setupJoint(joint);
} else {
logger.log(Level.INFO, "No joint match found for bone {0}", boneName);
if (resultScore > 0) {
logger.log(Level.INFO, "Best match found is {0} with score {1}", new Object[]{resultName, resultScore});
}
new JointPreset().setupJoint(joint);
}
}
示例2: setupJoint
import com.jme3.bullet.joints.SixDofJoint; //导入依赖的package包/类
public void setupJoint(SixDofJoint joint) {
joint.getRotationalLimitMotor(0).setHiLimit(maxX);
joint.getRotationalLimitMotor(0).setLoLimit(minX);
joint.getRotationalLimitMotor(1).setHiLimit(maxY);
joint.getRotationalLimitMotor(1).setLoLimit(minY);
joint.getRotationalLimitMotor(2).setHiLimit(maxZ);
joint.getRotationalLimitMotor(2).setLoLimit(minZ);
}
示例3: setJointLimit
import com.jme3.bullet.joints.SixDofJoint; //导入依赖的package包/类
public static void setJointLimit(SixDofJoint joint, float maxX, float minX, float maxY, float minY, float maxZ, float minZ) {
joint.getRotationalLimitMotor(0).setHiLimit(maxX);
joint.getRotationalLimitMotor(0).setLoLimit(minX);
joint.getRotationalLimitMotor(1).setHiLimit(maxY);
joint.getRotationalLimitMotor(1).setLoLimit(minY);
joint.getRotationalLimitMotor(2).setHiLimit(maxZ);
joint.getRotationalLimitMotor(2).setLoLimit(minZ);
}
示例4: getJoint
import com.jme3.bullet.joints.SixDofJoint; //导入依赖的package包/类
/**
* Return the joint between the given bone and its parent.
* This return null if it's called before attaching the control to a spatial
* @param boneName the name of the bone
* @return the joint between the given bone and its parent
*/
public SixDofJoint getJoint(String boneName) {
PhysicsBoneLink link = boneLinks.get(boneName);
if (link != null) {
return link.joint;
} else {
logger.log(Level.WARNING, "Not joint was found for bone {0}. make sure you call spatial.addControl(ragdoll) before setting joints limit", boneName);
return null;
}
}
示例5: addPMDNode
import com.jme3.bullet.joints.SixDofJoint; //导入依赖的package包/类
public void addPMDNode(PMDNode pmdNode) {
Skeleton skeleton = pmdNode.getSkeleton();
skeleton.updateWorldVectors();
PMDModel pmdModel = pmdNode.getPmdModel();
PMDRigidBody[] rigidBodyArray = new PMDRigidBody[pmdModel.getRigidBodyList().getRigidBodyArray().length];
rigidBodyMap.put(pmdNode, rigidBodyArray);
for (int i = 0; i < pmdModel.getRigidBodyList().getRigidBodyArray().length; i++) {
projectkyoto.mmd.file.PMDRigidBody fileRigidBody =
pmdModel.getRigidBodyList().getRigidBodyArray()[i];
Bone bone = null;
if (fileRigidBody.getRelBoneIndex() != 0xffff) {
bone = skeleton.getBone(fileRigidBody.getRelBoneIndex());
}
PMDRigidBody rb = createRigidBody(pmdNode, fileRigidBody, bone);
rigidBodyArray[i] = rb;
// btWorld.addRigidBody(rb, (short) (1 << fileRigidBody.getRigidBodyGroupIndex()),
// (short) fileRigidBody.getRigidBodyGroupTarget());
rb.setCollisionGroup(1 << (fileRigidBody.getRigidBodyGroupIndex()));
// if (fileRigidBody.getRigidBodyName().contains("スカート")) {
// rb.setCollideWithGroups(1 << 7);
// } else {
rb.setCollideWithGroups(fileRigidBody.getRigidBodyGroupTarget());
// }
// rb.setCollideWithGroups(0 );
physicsSpace.addCollisionObject(rb);
}
SixDofJoint constArray[] = new SixDofJoint[pmdModel.getJointList().getJointCount()];
constraintMap.put(pmdNode, constArray);
for (int i = 0; i < constArray.length; i++) {
SixDofJoint constraint = createConstraint(pmdNode,
rigidBodyArray, pmdModel.getJointList().getJointArray()[i]);
constArray[i] = constraint;
physicsSpace.add(constraint);
}
nodeRigidBodyArray = rigidBodyMap.values().toArray(new PMDRigidBody[rigidBodyMap.size()][]);
// physicsSpace.update(1 / 60f, 1);
}
示例6: removePMDNode
import com.jme3.bullet.joints.SixDofJoint; //导入依赖的package包/类
public void removePMDNode(PMDNode pmdNode) {
SixDofJoint[] constArray = constraintMap.remove(pmdNode);
if (constArray != null) {
for (SixDofJoint joint : constArray) {
physicsSpace.remove(joint);
}
}
PMDRigidBody[] rigidBodyArray = rigidBodyMap.remove(pmdNode);
if (rigidBodyArray != null) {
for (PMDRigidBody rb : rigidBodyArray) {
physicsSpace.remove(rb);
}
}
nodeRigidBodyArray = rigidBodyMap.values().toArray(new PMDRigidBody[rigidBodyMap.size()][]);
}
示例7: updateJointPosition
import com.jme3.bullet.joints.SixDofJoint; //导入依赖的package包/类
void updateJointPosition(SixDofJoint constraint, Line line) {
// constraint.getCalculatedTransformA(t1);
// constraint.getCalculatedTransformB(t2);
// v1.set(t1.origin.x, t1.origin.y, t1.origin.z);
// v2.set(t2.origin.x, t2.origin.y, t2.origin.z);
// line.updatePoints(v1, v2);
// line.setLineWidth(3f);
// line.setPointSize(3f);
// System.out.println("joint "+v1+" "+v2);
}
示例8: boneRecursion
import com.jme3.bullet.joints.SixDofJoint; //导入依赖的package包/类
private void boneRecursion(Spatial model, Bone bone, PhysicsRigidBody parent, int reccount, Map<Integer, List<Float>> pointsMap) {
PhysicsRigidBody parentShape = parent;
if (boneList.isEmpty() || boneList.contains(bone.getName())) {
PhysicsBoneLink link = new PhysicsBoneLink();
link.bone = bone;
//creating the collision shape
HullCollisionShape shape = null;
if (pointsMap != null) {
//build a shape for the bone, using the vertices that are most influenced by this bone
shape = RagdollUtils.makeShapeFromPointMap(pointsMap, RagdollUtils.getBoneIndices(link.bone, skeleton, boneList), initScale, link.bone.getModelSpacePosition());
} else {
//build a shape for the bone, using the vertices associated with this bone with a weight above the threshold
shape = RagdollUtils.makeShapeFromVerticeWeights(model, RagdollUtils.getBoneIndices(link.bone, skeleton, boneList), initScale, link.bone.getModelSpacePosition(), weightThreshold);
}
PhysicsRigidBody shapeNode = new PhysicsRigidBody(shape, rootMass / (float) reccount);
shapeNode.setKinematic(mode == Mode.Kinetmatic);
totalMass += rootMass / (float) reccount;
link.rigidBody = shapeNode;
link.initalWorldRotation = bone.getModelSpaceRotation().clone();
if (parent != null) {
//get joint position for parent
Vector3f posToParent = new Vector3f();
if (bone.getParent() != null) {
bone.getModelSpacePosition().subtract(bone.getParent().getModelSpacePosition(), posToParent).multLocal(initScale);
}
SixDofJoint joint = new SixDofJoint(parent, shapeNode, posToParent, new Vector3f(0, 0, 0f), true);
preset.setupJointForBone(bone.getName(), joint);
link.joint = joint;
joint.setCollisionBetweenLinkedBodys(false);
}
boneLinks.put(bone.getName(), link);
shapeNode.setUserObject(link);
parentShape = shapeNode;
}
for (Iterator<Bone> it = bone.getChildren().iterator(); it.hasNext();) {
Bone childBone = it.next();
boneRecursion(model, childBone, parentShape, reccount + 1, pointsMap);
}
}