Hello, for my scene with physics I followed HelloPhysics.java, but used the newer API style explained here: http://hub.jmonkeyengine.org/2011/01/18/changes-in-jmonkeyengine3-physics-system/
But none of my objects are moving. I also explicitly set gravity. For object creation, i did:
In my simpleInitApp() i have:
[java]
/** Set up Physics */
bulletAppState = new BulletAppState();
stateManager.attach(bulletAppState);
bulletAppState.getPhysicsSpace().setGravity(new Vector3f(0, 1f, 0));
bulletAppState.getPhysicsSpace().setAccuracy(0.005f);
[/java]
And:
[java]
sphere = new Sphere(32, 64, 0.25f);
sphereShape = new SphereCollisionShape(0.25f);
// sphere.setTextureMode(TextureMode.Projected);
geometry = new Geometry("ball", sphere);
geometry.setMaterial(material);
geometry.setLocalTranslation(pos);
final RigidBodyControl rigidBodyControl = new RigidBodyControl(sphereShape, 1f);
geometry.addControl(rigidBodyControl);
rootNode.attachChild(geometry);
[/java]
Any ideas?
you need to add the control/spatial to the physics space.
[java]bulletAppState.getPhysicsSpace().add(rigidBodyControl)[/java]
Sure enough that did it! Thanks. I thought that article was indicating that PhysicsSpace.add() was taken care of also with geometry.addControl().