Weapon Mounting
by Thomas Bang · in Torque Game Engine · 04/29/2009 (10:32 pm) · 7 replies
I have a problem to understand mounting of weapons in TGE.
The Weapon only rotates left/right but not up/down. So i started starter.fps (via LAN-Session) to see how the weapon of the opponent is animated (the up/down-rotation).
After checking the player-model (the orc) in ShowToolPro it seems that the up/down-rotation is a combination (blending) of the player-animations "look" (respectively "lookms" "looksn") and "head".
Is my assumption correct? If so... how can i play and stop animations depending on mouse movement and mouse speed?
The Weapon only rotates left/right but not up/down. So i started starter.fps (via LAN-Session) to see how the weapon of the opponent is animated (the up/down-rotation).
After checking the player-model (the orc) in ShowToolPro it seems that the up/down-rotation is a combination (blending) of the player-animations "look" (respectively "lookms" "looksn") and "head".
Is my assumption correct? If so... how can i play and stop animations depending on mouse movement and mouse speed?
#2
04/30/2009 (12:19 pm)
I did not found Player::updateLookAnimation in Starter.FPS...
#3
04/30/2009 (12:56 pm)
I believe its in the source. player.cc maybe?
#4
04/30/2009 (10:50 pm)
Yep, that's right. Sorry, should have mentioned that.
#5
Q1: Are the names of the sequences "look" and "head" necessary for updateLookAnimation?
Q2: In a FPS a combination of animations could be "stand" + "look" + "head" + "reloadWeapon3"
"stand": Cyclic, Thread-Slot 0, non-blending-sequence
"look": Non-Cyclic, Thread Slot ???, blending-sequence
"head": Non-Cyclic, Thread Slot ???, blending-sequence
"reloadWeapon3": Non-Cyclic, Thread Slot ???, blending-sequence
So i have 3 animations where the arms are animated ("look", "stand" and "reloadWeapon3"). I guess, i have only to animate the up-down-movement in "look" and the detailed arm-animation in "stand" and "reloadWeapon3".
Correct???
Q3: When i export a animated DTS, there is a property called "priority". You can see this also in ShowToolPro under "Sequence Info".
Which priority should i use for each of these four animations?
04/30/2009 (11:51 pm)
I have problems to understand Player::updateLookAnimation()Q1: Are the names of the sequences "look" and "head" necessary for updateLookAnimation?
Q2: In a FPS a combination of animations could be "stand" + "look" + "head" + "reloadWeapon3"
"stand": Cyclic, Thread-Slot 0, non-blending-sequence
"look": Non-Cyclic, Thread Slot ???, blending-sequence
"head": Non-Cyclic, Thread Slot ???, blending-sequence
"reloadWeapon3": Non-Cyclic, Thread Slot ???, blending-sequence
So i have 3 animations where the arms are animated ("look", "stand" and "reloadWeapon3"). I guess, i have only to animate the up-down-movement in "look" and the detailed arm-animation in "stand" and "reloadWeapon3".
Correct???
Q3: When i export a animated DTS, there is a property called "priority". You can see this also in ShowToolPro under "Sequence Info".
Which priority should i use for each of these four animations?
#6
2. Basically correct. For 'look' and 'head', no thread slot is needed, since the engine creates threads specifically for these animations that don't take up script-visible thread slots.
I'm not exactly sure how reloadWeapon should be exported or played, but probably not a blend animation.
3. I don't think priority will matter for these 4 animations. Basically, when two threads want to control the same bones of a character, the one with the higher priority gets to take them. However, blend animations don't use priority - they always affect the bones they animate, regardless of what other threads are doing.
05/02/2009 (1:32 am)
1. No. You see that in updateLookAnimation, the 'arm animation' is updated along with the head and headside animations. You can set which arm animation to use by using the setArmAnimation method. For head threads, however, the names 'head' and 'headside' are necessary - do a 'find all references' for mHeadHThread and you'll see that in Player::onNewDataBlock the sequences 'head' and 'headside' are used explicitly.2. Basically correct. For 'look' and 'head', no thread slot is needed, since the engine creates threads specifically for these animations that don't take up script-visible thread slots.
I'm not exactly sure how reloadWeapon should be exported or played, but probably not a blend animation.
3. I don't think priority will matter for these 4 animations. Basically, when two threads want to control the same bones of a character, the one with the higher priority gets to take them. However, blend animations don't use priority - they always affect the bones they animate, regardless of what other threads are doing.
#7
In Lightwave i combined "look" and "head" into one (blended) animation.
It works now.
05/02/2009 (1:40 am)
In the meantime i found out that i have to use %obj.setArmThread("look"); .In Lightwave i combined "look" and "head" into one (blended) animation.
It works now.
Torque Owner Daniel Buckmaster
T3D Steering Committee
Which animations do you want to play according to mouse movement? Are you trying to add your own? If so, have a look for Player::updateLookAnimation for an example of how vertical aiming is implemented. Basically, the sequence is played at a fixed point from start to end based on the angle the player is looking at (half way through the animation equates to horizontal).