Flying Dynamic Nodes

Ok, maybe someone knows what I'm missing. I actually have 2 problems, but it's the physics one that puzzles me.



I have 1 static floor and 3(2 wood, 1 iron) dynamic boxes of various sizes.



heres my creation code.


    private DynamicPhysicsNode createDynamicBox(HashMap res) {
      // create dynamic node
                 DynamicPhysicsNode dynamicNode = physicsGameState.getPhysicsSpace().createDynamicNode();
      debugGameState.getRootNode().attachChild( dynamicNode );
      
      
      String id = (String)res.get("id");
      String mat = (String)res.get("material");
      float x, y, z;
      float width, height, depth;
      x = Float.valueOf((String)res.get("x") );
      y = Float.valueOf((String)res.get("y") );
      z = Float.valueOf((String)res.get("z") );
      
      width    = Float.valueOf((String)res.get("width") );
      height    = Float.valueOf((String)res.get("height") );
      depth    = Float.valueOf((String)res.get("depth") );
      
      final Box visualFallingBox = new Box( (String)res.get("id") , new Vector3f(), width, height, depth );
                dynamicNode.attachChild( visualFallingBox );
                dynamicNode.generatePhysicsGeometry();
      
      dynamicNode.getLocalTranslation().set(x,y,z);
      
      dynamicNode.setMaterial(stringToMaterial(mat));
      dynamicNode.computeMass();
      
        return dynamicNode;
    }



now, once debug and phsycs states are activated the 3 dynamic nodes just sorta fly up to the sky. they are set to fall on each other, but in no way does that happen. am I missing something in my creation code that causing something funny.


the other problem and less concern. is that i'm currently not texturing or colouring. so the everything is textured with this matrix esque pattern.

do you have set some gravity on the physics space and set affected by gravity to true on the dynamic node?

hmm, no I didnt' set any properties. I was just running with default on creating. I new I must have been missing something.

Any good suggestions for an amount?



I still don't know why they would rocket up, then fall normaly. though even the iron one seems to be pretty light.


JaydeRyu said:

I still don't know why they would rocket up, then fall normalcy. though even the iron one seems to be pretty light.


ah they fall normally after they shoot into the air?
Then maybe they intersect with each other, or with another physic node at their initial position.
Also make sure to call updateGeometricstate() after setting the new position.

Your right it was coming from intersecting nodes. Also i'll start updating after I translate. A few times I still get intersection coming up. Thanks for the help.