Animation Control in C++

Return to C++ coding using Panda3D

Animation Control in C++

Postby Mujun » Sun Nov 18, 2007 11:28 pm

Hi guys... :)

I'm new to Panda3D, was checking out the engine with its libraries recently, and currently, trying to do model animations. I've searched through various threads on the forum, as well as documentation provided on the web, but I cant seem to find help for starting and stopping animations, in C++. I am able to load models and single animations.

Any help will be much appreciated. Thank you. :)
Posts: 2
Joined: Fri Nov 16, 2007 1:51 am

Postby rdb » Mon Nov 19, 2007 11:32 am

Animations in C++ work different than in Python.
To load an animation, you need to load it as separate model and bind it to the model. The auto_bind function gives you an AnimControlCollection, where you can extract your AnimControls from. You can use these to control your animation.
For example, if you want fine-control of the animation in the Hello World example:
Code: Select all
#include "auto_bind.h"
#include "animControlCollection.h"


  //load our panda
NodePath pandaActor = window->load_model(framework.get_models(),"panda-model");
  //load the walk animation
AnimControlCollection panda_anims;
auto_bind(pandaActor.node(), panda_anims, 0);
  //now you can do with _panda_anims whatever you want, e.g.:
  //where panda_walk_character is the name of the animation.

I'm currently in the process of creating a tutorial that will explain these things some more.

Hope this helps.
Posts: 11228
Joined: Mon Dec 04, 2006 5:58 am
Location: Netherlands

Postby Mujun » Tue Nov 20, 2007 9:12 am

Hey Thanks a lot!
I'll check up the references about AnimControls... Thanks! :)
Thanks. :)
Posts: 2
Joined: Fri Nov 16, 2007 1:51 am

Return to C++ coding using Panda3D

Who is online

Users browsing this forum: No registered users and 0 guests