Loading multiple models and animating - a query ?


//Load our panda
	NodePath pandaActor = window->load_model(framework.get_models(), "models/panda-model");
	pandaActor.set_scale(0.005);
	pandaActor.reparent_to(window->get_render());

	//Load the walk animation
	window->load_model(pandaActor, "models/panda-walk4");
	window->loop_animations(0); //Bind models and animations and set animations to loop

The above code loads and animate a single panda model.

Now if I want 10 panda models - do I have load the model 10 times from the disk or is there a way to load it one time and make 10 copies of it in the RAM and place it on the scene graph ? How do I apecify the co-ordinate loaction of each of the models at run-time ?

NodePath place_holder("Copy of");
pandaActor.copy_to( place_holder );
place_holder.reparent_to ( window->get_render() );

I don’t have any think to do so, I’ll answer all your questions as I can :wink:

EDIT: UPS I forgot where I take it [How to 'copy' a procedurally created node.)

Thank you my friend. Are you a professional or a university student or just an enthusiast ?

Close enough, I’m supposed to be in superior grade school (university on my country) but I loose a year and I’m on last grade of bachelor’s degree … but I’m going to university in a few months :slight_smile:, so I consider me an enthusiast.

Thanks anyway for helping me out…

Hi

I think Panda will remember loading a particular model and not actually go to the disk again for it when you keep calling load_model, so you should be able to just keep calling load_model.
If your are dealing with actors then take a look at the manual about actors and instances, if you want your actors all doing the same thing then I hear that instance_to is more efficient.

http://www.panda3d.org/manual/index.php/Instancing

Thank you Tah for the information.