Very massive dynamic rigid bodies may crash through low mass kinematic bodies when mass > 0. When activating VSync, it looks like the kinematic one gets a “push”.
Testet with minie-8.2.0.
public final class Test extends SimpleApplication {
@Override
public void simpleInitApp() {
final BulletAppState bullet = new BulletAppState();
bullet.setDebugEnabled(true);
getStateManager().attach(bullet);
final Material surfaceMat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
surfaceMat.setColor("Color", ColorRGBA.Red);
final Geometry surface = new Geometry("Surface", new Box(10f, 1f, 10f));
surface.setLocalTranslation(0, -5, 0);
surface.setMaterial(surfaceMat);
rootNode.attachChild(surface);
final Material sphereMat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
sphereMat.setTexture("ColorMap", assetManager.loadTexture("Textures/ColoredTex/Monkey.png"));
final Geometry sphere = new Geometry("Sphere", new Sphere(64, 64, 5f));
sphere.setLocalTranslation(0, 20, 0);
sphere.setMaterial(sphereMat);
rootNode.attachChild(sphere);
rootNode.updateGeometricState();
final RigidBodyControl surfaceBody = new RigidBodyControl(new BoxCollisionShape(10f, 1f, 10f), 1.0f);
surfaceBody.setKinematic(true);
surface.addControl(surfaceBody);
bullet.getPhysicsSpace().add(surfaceBody);
final RigidBodyControl sphereBody = new RigidBodyControl(new SphereCollisionShape(5f), 250.0f);
sphere.addControl(sphereBody);
bullet.getPhysicsSpace().add(sphereBody);
}
public static void main(final String[] args) {
new Test().start();
}
}
That kinematic bodies block objects independent of their mass. It also makes no sense, that a solid body with finite mass can move through another one, make it?
You asked what he expected to happen. He says he wants collisions but it not getting collisions.
Probably the super-heavy weight of the object is causing tunneling? Not familiar enough with the tolerances of this physics engine but I think a mass of 250 is probably quite high.
Maybe I am absolutely wrong, but I thought, a kinematic is a solid body that should never handle impulses transferred from other bodies but transfer their own impulses to other bodies.
Another strange behavior led me to this, and I now figured out, what happened:
When setting contact damping or contact stiffness to a kinematic, even when using the default values of the rigid body, and a CharacterControl stand on it, then the kinematic is “pressed” down.
public final class Test extends SimpleApplication {
@Override
public void simpleInitApp() {
final BulletAppState bullet = new BulletAppState();
bullet.setDebugEnabled(true);
getStateManager().attach(bullet);
final Material surfaceMat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
surfaceMat.setColor("Color", ColorRGBA.Red);
final Geometry surface = new Geometry("Surface", new Box(10f, 1f, 10f));
surface.setLocalTranslation(0, -5, 0);
surface.setMaterial(surfaceMat);
rootNode.attachChild(surface);
final Material sphereMat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
sphereMat.setTexture("ColorMap", assetManager.loadTexture("Textures/ColoredTex/Monkey.png"));
final Geometry sphere = new Geometry("Sphere", new Sphere(64, 64, 5f));
sphere.setLocalTranslation(0, 20, 0);
sphere.setMaterial(sphereMat);
rootNode.attachChild(sphere);
rootNode.updateGeometricState();
final RigidBodyControl origin = new RigidBodyControl(new BoxCollisionShape(10f, 1f, 10f), 1f);
final RigidBodyControl surfaceBody = new RigidBodyControl(new BoxCollisionShape(10f, 1f, 10f), 1f);
surfaceBody.setContactDamping(origin.getContactDamping());
//surfaceBody.setContactStiffness(origin.getContactStiffness());
surfaceBody.setKinematic(true);
surface.addControl(surfaceBody);
bullet.getPhysicsSpace().add(surfaceBody);
//final RigidBodyControl sphereBody = new RigidBodyControl(new SphereCollisionShape(5f), 1.0f);
final CharacterControl sphereBody = new CharacterControl(new SphereCollisionShape(5f), 0.3f);
sphere.addControl(sphereBody);
bullet.getPhysicsSpace().add(sphereBody);
}
public static void main(final String[] args) {
new Test().start();
}
}