Shared nodes and Ogre animations

Hi can I load an ogre object with animation, put it in a shared node and then still use the animation?

I've tried but i getControllerCount() return 0… tried on the shared node and on all his children…



here myself is the sharednode


for (Spatial s:myself.getChildren()){
               System.out.println( "t controller:"+s.getControllerCount() );
               for (int i=0; i<s.getControllerCount();i++){
                  MeshAnimationController animControl = (MeshAnimationController) s.getController(i);
                  AnimationChannel lower = animControl.getAnimationChannel();
                  lower.addFromRootBone("Bone_L");
                  animControl.setAnimation(lower, "Left Cube");
                  System.out.println( "t azone eseguita" );
               }
            }



NB: using a node insted a shared note works fine... i'm getting crezy with this shared node!! they don't like quadmesh and now animation :(

They dont because the animation would be shared as well. In the best case you would have them all perform the same animation which is surely not what you want.  You will always need separate models that you animate.

However you can share the meshes that are in the model. You will have to dive into the tree structure of your model after you load it and then replace all meshes with SharedMeshes which you create from the first time you load the model.

Since most of the time there will be MeshAnimation going on sharing the meshes in the model wont work either.



Hope this helps,

Normen

I believe there's a MeshCloner or similar class that can be used to clone ogre models with animations and all. You can only use SharedNode for static models.

ok thank you, and there is a way to clone my node without load it again? actually I'm loading 100 sphere and it took more than 2 or 3 second… because in my game obj will be loaded dynamically, i will not load 100 obj at one time ( this is just the net and physic stress test :stuck_out_tongue: ) but in some circumstances can append (like now^^)

lesto wrote:
is a way to clone my node without load it again?
As Momoko_Fan suggested, use MeshCloner.

The JME test class for the Ogre Instancing (using MeshCloner): jmetest.ogrexml.TestInstancing