Hello,
has anyone successfully used JBullet on Android? I got some weird behaviour when using a simple BoxShape. It acts almost like a cylinder. It comes to rest correctly on two opposite sides (say 1 and 6 on a dice). But it roles like a wheel when on any other side (with a line from 1 to 6 as the axis).
This is how I initialize the world (That’s basically the same as in the BasicDemo):
// collision configuration contains default setup for memory, collision
// setup
CollisionConfiguration collisionConfiguration = new DefaultCollisionConfiguration();
// use the default collision dispatcher. For parallel processing you can
// use a diffent dispatcher (see Extras/BulletMultiThreaded)
CollisionDispatcher dispatcher = new CollisionDispatcher(
collisionConfiguration);
BroadphaseInterface broadphase = new DbvtBroadphase();
// the default constraint solver. For parallel processing you can use a
// different solver (see Extras/BulletMultiThreaded)
ConstraintSolver solver = new SequentialImpulseConstraintSolver();
mDynamics = new DiscreteDynamicsWorld(dispatcher, broadphase, solver,
collisionConfiguration);
mDynamics.setGravity(new Vector3f(0f, -10f, 0f));
Afterwards I define some static shapes for the ground and for the walls and then I just want to create a simple cube:
CollisionShape colShape = new BoxShape(new Vector3f(1, 1, 1));
// Create Dynamic Objects
Transform startTransform = new Transform();
startTransform.setIdentity();
float mass = 1f;
Vector3f localInertia = new Vector3f(0, 0, 0);
colShape.calculateLocalInertia(mass, localInertia);
// using motionstate is recommended, it provides
// interpolation capabilities, and only synchronizes
// 'active' objects
DefaultMotionState myMotionState = new DefaultMotionState(
startTransform);
RigidBodyConstructionInfo rbInfo = new RigidBodyConstructionInfo(mass,
myMotionState, colShape, localInertia);
dice = new RigidBody(rbInfo);
dice.setActivationState(RigidBody.ACTIVE_TAG);
mDynamics.addRigidBody(dice);
Most of the code is taken directly from the examples so I wonder what I am doing wrong here.
Here is a video for demonstration:
Any suggestions?