Как заставить Soft Body подпрыгивать в LibGDX Bullet Physics.Я установил Реституцию шарика мягкого тела на 0,5, а заземление твердого тела на 1,0.Я пробовал btSoftBody для объекта Ball и btRigidBody для наземного объекта.Мяч не подпрыгивает при ударе о землю.
@Override
public void create() {
super.create();
world.maxSubSteps = 20;
world.add("ground", 0f, 0f, 0f).setColor(0.25f + 0.5f * (float) Math.random(), 0.25f + 0.5f * (float) Math.random(), 0.25f + 0.5f * (float) Math.random(), 1f);
final Texture texture = new Texture(Gdx.files.internal("data/badlogic.jpg"));
final Material material = new Material(TextureAttribute.createDiffuse(texture), ColorAttribute.createSpecular(1, 1, 1, 1), FloatAttribute.createShininess(8f));
final long attributes = Usage.Position | Usage.Normal | Usage.TextureCoordinates;
final Model sphere = modelBuilder.createSphere(0.5f, 0.5f, 0.5f, 24, 24, material, attributes);
model = sphere;
MeshPart meshPart = model.nodes.get(0).parts.get(0).meshPart;
meshPart.mesh.scale(6, 6, 6);
indexMap = BufferUtils.newShortBuffer(meshPart.size);
positionOffset = meshPart.mesh.getVertexAttribute(Usage.Position).offset;
normalOffset = meshPart.mesh.getVertexAttribute(Usage.Normal).offset;
softBody = new btSoftBody(worldInfo, meshPart.mesh.getVerticesBuffer(), meshPart.mesh.getVertexSize(), positionOffset, normalOffset, meshPart.mesh.getIndicesBuffer(), meshPart.offset, meshPart.size, indexMap, 0);
btSoftBody.Material pm = softBody.appendMaterial();
pm.setKLST(0.9f);
pm.setFlags(0);
softBody.generateBendingConstraints(2, pm);
softBody.setConfig_piterations(90);
softBody.setConfig_kDF(0.5f);
softBody.setConfig_kCHR(1);
softBody.setConfig_kDP(0);
softBody.randomizeConstraints();
softBody.setTotalMass(0.01f, true);
softBody.setContactStiffnessAndDamping(2000f, 0f);
softBody.generateClusters(1);
softBody.setConfig_maxvolume(200f);
softBody.setRestitution(0.5f);
softBody.setCollisionFlags(softBody.getCollisionFlags() | btCollisionObject.CollisionFlags.CF_CUSTOM_MATERIAL_CALLBACK);
softBody.setFriction(0f);
((btSoftRigidDynamicsWorld) (world.collisionWorld)).addSoftBody(softBody);
world.entities.get(0).body.setRestitution(1f);
world.add(entity = new BulletEntity(model, (btCollisionObject) null, 1, 5, 1));
softBody.setActivationState(Collision.WANTS_DEACTIVATION);
softBody.translate(tmpV.set(1, 5, 1));
}