Moving from simplegame to basegame physics stopped working

I was able to get physics working in simplegame no prob but when i try it in basegame the box doesnt fall.

Im pretty new to programming so i assume im missing something simple, here is the code…

any help would be greatly appreciated

package main;

import com.jme.bounding.BoundingBox;
import com.jme.input.KeyBindingManager;
import com.jme.input.KeyInput;
import com.jme.math.Vector3f;
import com.jme.renderer.Camera;
import com.jme.renderer.ColorRGBA;
import com.jme.scene.Node;
import com.jme.scene.shape.Box;
import com.jme.system.DisplaySystem;
import com.jme.system.JmeException;
import com.jme.util.Timer;
import com.jmex.physics.DynamicPhysicsObject;
import com.jmex.physics.PhysicsObject;
import com.jmex.physics.PhysicsWorld;
import com.jmex.physics.StaticPhysicsObject;

public class DiceGame extends BaseGame {
   protected Timer timer;
   private Camera cam;
   private Node scene;   
   private int width, height, depth, freq;
   private boolean fullscreen;
   public static void main(String[] args) {
      DiceGame app = new DiceGame();
      app.setDialogBehaviour(ALWAYS_SHOW_PROPS_DIALOG, DiceGame.class.getClassLoader()
   protected void initSystem() {
      width = properties.getWidth();
      height = properties.getHeight();
      depth = properties.getDepth();
      freq = properties.getFreq();
      fullscreen = properties.getFullscreen();
      try {
         display = DisplaySystem.getDisplaySystem(properties.getRenderer());
         display.createWindow(width, height, depth, freq, fullscreen);
         cam = display.getRenderer().createCamera(width, height);
      } catch (JmeException e) {
      //set the background to black
      //initialize the camera
      cam.setFrustumPerspective(45.0f, (float)width / (float)height, 1, 1000);
      Vector3f loc = new Vector3f(0.0f, 0.0f, 25.0f);
      Vector3f left = new Vector3f(-1.0f, 0.0f, 0.0f);
      Vector3f up = new Vector3f(0.0f, 1.0f, 0.0f);
      Vector3f dir = new Vector3f(0.0f, 0f, -1.0f);
      // Move our camera to a correct place and orientation.
      cam.setFrame(loc, left, up, dir);
      /** Signal that we've changed our camera's location/frustum. */
       /** Get a high resolution timer for FPS updates. */
       timer = Timer.getTimer(properties.getRenderer());
   protected void initGame() {
      scene = new Node("Scene graph node");
      scene.updateGeometricState(0.0f, true);
   private void buildPhysicsBox(){
      Box floorGraphics = new Box("Floor", new Vector3f(), 50, 1, 50);
      //floorGraphics.setModelBound(new BoundingBox());
      floorGraphics.setLocalTranslation(new Vector3f(0, -14, 10));
      Box b = new Box("b", new Vector3f(), 10, 10, 10);
      b.setLocalTranslation(new Vector3f(0, 0, -40));
      b.setModelBound(new BoundingBox());
      PhysicsObject floorPhysics = new StaticPhysicsObject(floorGraphics);
      PhysicsObject dice1Physics = new DynamicPhysicsObject(b, 10f);
   protected void reinit() {
      display.recreateWindow(width, height, depth, freq, fullscreen);
   protected void cleanup() {
   protected void update(float interpolation) {
      interpolation = timer.getTimePerFrame();
      //if escape was pressed, we exit
      if (KeyBindingManager.getKeyBindingManager().isValidCommand("exit")) {
         finished = true;
   protected void render(float interpolation) {

Hmmm, looks alright to me.  I would try it on my machine, but it will have to wait until this evening.


:smiley: ok i figured it out. I was missing this line in the update method

scene.updateGeometricState(timer.getTimePerFrame(), true);

Hehe, I was looking for a physics issue. :)  Good debugging. :wink: