Game Development Community

Ground speed of walk/run animations

by Orion Elenzil · in Torque Game Engine · 01/04/2006 (5:26 pm) · 1 replies

Hi All.

We must be doing something wrong,
maybe someone can clear it up for me.

Basically i noticed that our walk animation was not sticking well to the floor,
and traced back thru the code and found in player.cc:

void PlayerData::getGroundInfo(TSShapeInstance* si, TSThread* thread,ActionAnimation *dp)
{
   dp->death = !dStrnicmp(dp->name, "death", 5);
   if (dp->death)
   {
      // Death animations use roll frame-to-frame changes in ground transform into position
      dp->speed = 0;
      dp->dir.set(0,0,0);
   }
   else 
   {
      VectorF save = dp->dir;
      si->setSequence(thread,dp->sequence,0);
      si->animate();
      si->advanceTime(1);
      si->animateGround();
      si->getGroundTransform().getColumn(3,&dp->dir);
      if ((dp->speed = dp->dir.len()) < 0.01)
         {
            dp->dir = save;
            dp->speed = 1;
            dp->velocityScale = false;
         }
   .
   .
   .

the problem is that all our perambulatory animations (run, side, etc)
come in to this routine with nicely set-up values of dp->dir (eg 0 1 0),
but the getGroundTransform() line stomps dp->dir with zero,
which then results in velocityScale being false,
which later in the code leads to the animation not being scaled by velocity.

so -
any idea what we've got wrong ?

thanks,
ooo

#1
01/08/2006 (1:42 am)
You should ask the people in the artist forums nicely about ground transforms and how they work. :)