Game Development Community

Is setArmThread() for different weapons still working?

by game4Rest · in Torque Game Engine · 11/09/2006 (8:38 pm) · 2 replies

Greetings!

For different arm positions for different weapons, we have to define the armThread for the weapon Image at first. Then in the function WeaponImage::onMount(), choose the appropriate arm thread.
if(%this.armThread $= "")
      %obj.setArmThread(lookde);
else
      %obj.setArmThread(%this.armThread);

With this understanding, I added armThread for my own weapon named "lookmx57". This crashed my game hard. I even changed that armThread name with "lookms","looknw","looksn", but same resuts.

This time, with default look animation "lookde", I tried to find out if it worked fine. But it didn't work for me. When I moved my mouse to aim high, my player didn't move the gun higher at all.

So, after looking into the code, I found these lines in the PlayerData::preLoad.

const char *lookName = StringTable->insert("look");
for (int c = 0; c < actionCount; c++,dp++)
      if (dp->name == lookName)
         lookAction = c;

According to above code, only thread with name "look" can be added to lookAction, "lookxx" can not be played. After my changing the sequence name to "look", it worked like below image.
www.silevo.co.kr/ss01.png

Is it all supposed to happen? I've found so many thread about different arm position. But no one has mentioned about it. If it is true, has anyone found a better way to implement this different arm position?

Thanks in advance.
Hongjin

edit : indent for codes

#1
11/12/2006 (12:58 am)
I think I got the answer.
To make the setArmThread() properly, we have to make sure to include "look" animation in the player TSShapeConstructor. After this, engine will not complain anymore whatever look animation you call in the
weaponImage::onMount().
My problem was that I didn't include "look" animation in the player constructor.
Hope this help anyone.
Hongjin
#2
11/12/2006 (3:11 am)
Thanks for sharing your solution, Hong!