Re: [Plib-users] TweenController in plib
Brought to you by:
sjbaker
|
From: Steve B. <sjb...@ai...> - 2002-07-11 01:04:11
|
Rolf Jakob wrote:
> I try to get a tween controller to work with the current CVS snapshot. What I
> did :
> Used exposer to have some animation and saved a tweened model with a bank
> every second.
> Load the model using ssgLoadSSG resulting to a hierarchy starting with an
> ssgEntity. In fact this should be a ssgTweenController.
Well, ssgEntity is an abstract base class in SSG - you can't have a 'pure'
ssgEntity - it's always some kind of derived class.
> Create a ssgTransform and add the tween controller as a kid to be able to
> transform the model in the scene.
> Use the ssgTransform for transformation and the ssgTweenController for the
> animation (this one has to be casted from ssgEntity).
> The animation has the default length of 10 seconds, so I should have 10 banks.
Sounds reasonable.
> The problem is I cannot see the model moving, it's always in its first
> position. A debug shows that the bank selecting factor travels from 0.0 to
> somewhere near 10 and restarts at 0.0, so that should be ok.
Indeed.
> I'm quite sure I miss something very simple, but what ?
> Is the way I got the model into the scene the way it should be ? Is the type
> of the root node preserved from exposer through a ssgLoadSSG() ?
Yes - it should be.
> Code sniplets:
> // global
> ssgTransform *femme=0;
> ssgEntity *femme_obj;
>
> // init
> femme=new ssgTransform;
> femme_obj=ssgLoadSSG("player-female_tweened.ssg");
> femme->addKid(femme_obj);
> sgCoord fc;
> sgSetCoord(&fc,1.67,0.126,0,90,0,0);
> femme->setTransform(&fc);
> scene->addKid(femme);
>
> // redraw
> float bank=(frameno%140)/14.0;
> ((ssgTweenController *)femme_obj)->selectBank(bank);
> cerr << "bank : " << bank << endl;
Well, that *looks* OK.
One of my programs does this:
body_tween = new ssgTweenController () ;
body_tween -> addKid ( ssgLoad ( "body.ssg" , loader_opts ) ) ;
...and then...
void update_motion ()
{
static int frameno = 0 ;
frameno++ ;
body_tween -> selectBank ( (float)frameno/100.0 ) ;
}
...so I think you are basically doing the right thing - you must have
a bug somewhere. I guess you should do:
cerr << femme->getTypeName() << endl ;
...to be sure that you really have an ssgTweenController.
----------------------------- Steve Baker -------------------------------
Mail : <sjb...@ai...> WorkMail: <sj...@li...>
URLs : http://www.sjbaker.org
http://plib.sf.net http://tuxaqfh.sf.net http://tuxkart.sf.net
http://prettypoly.sf.net http://freeglut.sf.net
http://toobular.sf.net http://lodestone.sf.net
|