Could it be that a attacheChild may only be called at init?

Hello,



I have got an AxisRod showing up correctly. If I try to attach a new AxisRods to the first one,



Axisrods axisRods2=new AxisRods();

axisRods1.attachChild(axisRods2);



it is not displayed. Why? This drives me crazy. There is something I don't understand in this engine. I also tried to use GameTaskQueueManager etc… The second Axisrods is added directly after the init of the first in the doSetup emthod.



What am I doing wrong?



Thanks,

Equilibrium

Did you call updateRenderState on axisRods1?

I don't know what classes you're using, but most of them call updateGeometricState in their updateMethod so that should not be needed when the game is running.

Do they look the same?

As they seem to be in the same location, perhaps the first is hiding the second?

Try to set local translation for the second one.

I tried all of this. It really drives me nuts. The strange thing is following.

If I write


GameTaskQueueManager.getManager().getQueue(GameTaskQueue.UPDATE).enqueue(new Callable() {
                public Object call() throws Exception {
                    AxisRods axis1 = new AxisRods("a1");
                    axis1.setLocalTranslation(2, 0, 0);
                    sceneGraphRootNode.attachChild(axis1);
                    return null;
                }
            });



everything works fine BUT if I write

GameTaskQueueManager.getManager().getQueue(GameTaskQueue.UPDATE).enqueue(new Callable() {
                public Object call() throws Exception {                    
                    sceneGraphRootNode.attachChild(getAxisRodsFromAMethod());
                    return null;
                }
            });

public Node getAxisRodsFromAMethod(){
 AxisRods axis1 = new AxisRods("a1");
                    axis1.setLocalTranslation(2, 0, 0);                  
                    return axis1;
}



it DOES NOT work. The problem is, as far as I understand, that I call a new AxisRods() or new Node() or whatever constructor from within the EventDispatcher Thread. Although I could even SAVE a reference to such a JME Spatial object (it is not null!!!), it seems to be invalid in any way....

You must know that I write a graphical SceneGraph editor in Netbeans. So, perhaps you understand the connection between Swing, NetBeans and JME better than me. Thanks a lot for help.

Regards

I found the mistake.



I didn't return an AxisRods object but a simple Node object which had an AxisRods object attached. If I only return the AxisRods objects everything works. This raises the question :), why is my AxisRods object which has been attached to the simple Node object not drawn if the simple Node object is attached to the rootNode?





hmmmmmmm




If I tell you what the mistake is, you won't belive.



Image, you must init the nodes with the STRING constructor. can you imagine that? With the STRING constructor. I mean, this was the largest waste of time in my life.



Hope the monkeys will jump around now in my app…



Regards,