Loading multiple models and animating - a query ?

Return to C++ coding using Panda3D

Loading multiple models and animating - a query ?

Postby Juggernaut » Mon Apr 30, 2012 11:57 am

Code: Select all

//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 ?
Juggernaut
 
Posts: 90
Joined: Sat Feb 11, 2012 5:46 am

Yep, junt copy.

Postby EdmundosTown » Mon Apr 30, 2012 12:20 pm

Code: Select all
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 ;)


EDIT: UPS I forgot where I take it http://www.panda3d.org/forums/viewtopic.php?t=1682
EdmundosTown
 
Posts: 26
Joined: Mon Oct 17, 2011 1:36 pm
Location: Mexico City, Mexico

Postby Juggernaut » Mon Apr 30, 2012 12:29 pm


I don't have any think to do so, I'll answer all your questions as I can.



Thank you my friend. Are you a professional or a university student or just an enthusiast ?
Juggernaut
 
Posts: 90
Joined: Sat Feb 11, 2012 5:46 am

Not at all...

Postby EdmundosTown » Mon Apr 30, 2012 1:05 pm

university student


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 :), so I consider me an enthusiast.
EdmundosTown
 
Posts: 26
Joined: Mon Oct 17, 2011 1:36 pm
Location: Mexico City, Mexico

Postby Juggernaut » Mon Apr 30, 2012 2:32 pm

Thanks anyway for helping me out...
Juggernaut
 
Posts: 90
Joined: Sat Feb 11, 2012 5:46 am

Postby tah » Mon Apr 30, 2012 3:48 pm

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
tah
 
Posts: 173
Joined: Fri Oct 29, 2010 3:25 pm
Location: Torrance, CA.

Postby Juggernaut » Tue May 01, 2012 6:49 am

Thank you Tah for the information.
Juggernaut
 
Posts: 90
Joined: Sat Feb 11, 2012 5:46 am


Return to C++ coding using Panda3D

Who is online

Users browsing this forum: No registered users and 0 guests

cron