Game Development Community

T3D 1.1 Beta 3 - Player::setActionThread - LOGGED

by elvince · in Torque 3D Professional · 10/03/2010 (4:44 pm) · 14 replies

Build: 1.1 Beta 3

Platform: Windows 7 64 bit,

Target:Player::setActionThread

Issues: If you call %obj.setActionThread("root", true, true); this will never work.

Suggested Fix: in player.cpp, in Player::setActionThread, start the loop from 0 and not 1 otherwise the root animation will never be activated.

#1
10/03/2010 (6:10 pm)
Nice!
There is also a long standing bug in packupdate()

if (stream->writeFlag(mask & ActionMask &&
         mActionAnimation.action != PlayerData::NullAnimation &&
         mActionAnimation.action >= PlayerData::NumTableActionAnims)) {

should be replace with

if (stream->writeFlag(mask & ActionMask &&
         mActionAnimation.action != PlayerData::NullAnimation &&
         mActionAnimation.action <= PlayerData::NumTableActionAnims)) {

I think these two bugs were logged and fixed,but still not integrated in beta 3.
#2
10/04/2010 (6:43 am)
thanks for this additional information. I hope this will be fix in the next release.
#3
10/08/2010 (3:27 pm)
Logged as TQA-1173
#4
02/15/2011 (7:35 am)
Greetings!

I've been looking into this issue and have a couple of questions. But first, I wanted to talk about how I understand the Player animation system works. player.h defines an enum that all action animations fall under:

enum {
      // *** WARNING ***
      // These enum values are used to index the ActionAnimationList
      // array instantiated in player.cc
      // The first several are selected in the move state based on velocity
      RootAnim,
      RunForwardAnim,
      BackBackwardAnim,
      SideLeftAnim,

      CrouchRootAnim,
      CrouchForwardAnim,
      ProneRootAnim,
      ProneForwardAnim,
      SwimRootAnim,
      SwimForwardAnim,
      SwimBackwardAnim,
      SwimLeftAnim,
      SwimRightAnim,
      
      // These are set explicitly based on player actions
      FallAnim,
      JumpAnim,
      StandJumpAnim,
      LandAnim,
      JetAnim,
      
      // 
      NumMoveActionAnims = SideLeftAnim + 1,
      NumTableActionAnims = JetAnim + 1,

      NumExtraActionAnims = 512 - NumTableActionAnims,
      NumActionAnims = NumTableActionAnims + NumExtraActionAnims,
      ActionAnimBits = 9,
      NullAnimation = (1 << ActionAnimBits) - 1
   };

Everything defined down to and including JetAnim are special action animations that are used based on rules in Player::pickActionAnimation(). These are the NumTableActionAnims sequences. A combination of pose and motion determine which of these action animations will be played on the Player.

Then we have the NumExtraActionAnims which may be user defined. Sequences such as sitting, etc. end up here. These action animations may be played on the Player using the setActionThread() method (or playThread() as well).

Player::pickActionAnimation() itself is called is called from Player::updateActionThread() when the player has a NULL animation selected, or we're at the end of an animation and should not hold at the end (plus some mounting logic).

@elvince:
Under what circumstances are you trying to force the Player back to root? Normally that is something that comes out of pickActionAnimation() or unmounting.

@Ivan:
I'm not sure that you'd want to only send across NumTableActionAnims in packUpdate(). These are normally automatically chosen from pickActionAnimation(), and I believe that would stop any NumExtraActionAnims from playing by using setActionThread(), such as choosing a sit sequence when mounted.

- Dave
#5
02/15/2011 (8:49 am)
Dave,you're right.This code breaks the AI animation.
http://www.garagegames.com/community/forums/viewthread/122277
#6
04/14/2011 (12:57 pm)
Any update on this? Will it be fixed in the next release?

I didn't see any update on this thread nor on the url mentionned by Ivan.

Thanks
#7
04/22/2011 (5:17 pm)
@elvince

Without more information on what circumstances you're trying to force the player back to root, as Dave asked for a couple months ago, we're forced to resolve this "As Designed". If you can give us more information about it then we can take another look at it, otherwise I'll mark this one As Designed since that's not the normal usage for setting the root.
#8
04/23/2011 (12:46 am)
Hi, Sorry I may have miss that.

In fact, it's te code when you umount from an object. By exemple a chair. Don t use a vehicule as If I remembered well you apply an impulse and that cause things to "work".

So create a chair with mountpoint. Mount your player on it and umount. You will face the issue and why I put this fix.
I hope it help and sorry for not shared more information before.

Thanks
#9
04/23/2011 (4:15 am)
@ elvince

If you apply some changes to packUpdate() and setActionThread() this would unlock the option to set NullAnimation (511) from script. On the next tick you will receive the root(or run) animation on the fly,depending on your velocity.
#10
04/23/2011 (5:14 am)
I will look into that. I think in the stock source we should be able to unmount from a chair and get the root animation.
In all case I will look at tour suggestion.

Thanks
#11
05/01/2011 (9:51 am)
@Scott,
Have you been able to test a chair mount/unmount and see the issue ?

Thanks,
#12
05/01/2011 (2:23 pm)
Greetings!

@elvince:
There was a problem with not resetting to root following an unmount. I also ran across it when unmounting from a chair in my game. That should be corrected in 1.1 Preview. Have you had a chance to try out 1.1 Preview yet to see if you're still having this issue?

I'll look for the ticket later tonight if you'd like the specifics on the change.

- Dave
#13
05/01/2011 (10:13 pm)
@elvince:
Here's the thread with my fix:
www.garagegames.com/community/forums/viewthread/123711

Check that out and see if it helps. Or see if upgrading to 1.1 Preview solves it for you

- Dave
#14
05/05/2011 (12:00 am)
Hi,

I confirm it's working in preview.

Thanks,