After update the sources of JME3 I have a problem

Hello,



Today I update the sources of JME3 (the last project update was 5 or 6 days ago) and netbeans return me this problem when run a project, that before the update was ok:



26-jul-2010 14:40:30 com.jme3.app.Application handleError

GRAVE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]

java.lang.IllegalStateException: Spatial should not be attached to parent while creating compound collision shape!

        at com.jme3.bullet.util.CollisionShapeFactory.createCompoundShape(CollisionShapeFactory.java:100)

        at com.jme3.bullet.util.CollisionShapeFactory.createMeshCompoundShape(CollisionShapeFactory.java:112)

        at robotsSimulator.Roboter.createPhysicsBase(Roboter.java:204)





public PhysicsNode createPhysicsBase(){
        Spatial robotNodes = robotTempNode.getChild(0);
        Node n = (Node)robotNodes;
        System.out.println("num hijos


"+n.getChildren().size());

   Spatial sp = n.getChild("bancada-node");


        CompoundCollisionShape Shape = CollisionShapeFactory.createMeshCompoundShape((Node) sp);
        PhysicsNode basePhysNode = new PhysicsNode(sp, Shape, 0);
        basePhysNode.setName(sp.getName());
        basePhysNode.setLocalTranslation(0, 0, 0);
        basePhysNode.attachDebugShape(assetManager);


   basePhysNode.updateModelBound();
        basePhysNode.updateGeometricState();
        basePhysNode.updatePhysicsState();
        physicsSpace.add(basePhysNode);
        robot.attachChild(basePhysNode);

        return basePhysNode;
    }



Thanks for your time.

No, before the update you already did it wrong, now the software tells you :stuck_out_tongue_winking_eye:

So what more can I say than the error message? The spatial should not be attached to a node while creatimg the collision shape. Do sp.removeFromParent() after the getChild() thing.



Cheers,

Normen

wow, very fast reply!



I feel a bit stupid. After posting the problem ctrl+space has given me the solution.



thank you.