Collision Bug in 0.9

Just an update. I realized that my workaround of passing in the child geometry doesn't appear to work because it only allows collisions on that particular part and not the entire model. I'll also add that I've tried several things to get the bound data to propagate up to the node for the physics engine, but no dice.



Also, when I turn on the bounds, the model appears to have well defined bounds but the bullets (which also have good bounds) just pass right through. Anyone have any suggestions or thoughts?




Hmm, your description is a little bit too unspecific to reproduce - CompoundedObjectTest seems to do exactly what you are describing (creating DynamicPhysicsObject from a Node), and it works well.



Though I have noticed some problems with nested Nodes. That's why I'm inspecting the PhysicsEntityFactory and rewriting big parts of it… so probably just stay tuned…

Understood. Dunno if this helps, but here are some code snippets to give you an idea what I'm doing.



Load the model in my shipCreator.


         JmeBinaryReader jbr = new JmeBinaryReader();
         URL TexDir = Planet.class.getClassLoader().getResource(
               "resources/texture/ships/" + n + "/");
         URL planetModelURL = IngameState.class.getClassLoader()
               .getResource("resources/model/ships/" + n + "/ship.jme");

         try {
            jbr.setProperty("bound", "box");
            jbr.setProperty("texurl", TexDir);
            jbr.setProperty("tex_type", new Integer(
                  Image.GUESS_FORMAT_NO_S3TC));
            shipModel[n] = jbr
                  .loadBinaryFormat(planetModelURL.openStream());
         } catch (Exception e) {
         }



Clone the model and save for later.

cloneCreator[n] = new CloneCreator(shipModel[n].getChild(0));
         cloneCreator[n].addProperty("vertices");
         cloneCreator[n].addProperty("normals");
         cloneCreator[n].addProperty("colors");
         cloneCreator[n].addProperty("texcoords");
         cloneCreator[n].addProperty("indices");
         cloneCreator[n].addProperty("vboinfo");



The cloneCreator method

   public Node loadModel(int shipModelId) {
      return (Node) cloneCreator[shipModelId].createCopy();
   }



Finish initing geometry for the ship and create physics object.


      ShipCreator shipCreator = ShipCreator.getNew();
      shipModel = shipCreator.loadModel(shipModelId);
   
      this.attachChild(shipModel);
      shipNode.attachChild(this);
      shipNode.updateGeometricState(0, true);
      shipNode.getParent().updateRenderState();
      
      po = new DynamicPhysicsObject(this, getMass());
      PhysicsWorld.getInstance().addObject(po);
      po.syncWithGraphical();



"this" is a ship class extending Node. So your comment about nested nodes is interesting, as this is the case here. Although I have tried directly using the shipModel node and still no go. Thanks for your help and look forward to your update.


I have fixed some things for my own models to load  :). Please try yours with updated jmephysics…

Irrisor, nice job! Preliminary tests show collisions to be working again. Thanks! I'll do more extensive testing later tonight and if anything looks odd, I'll let you know.