Weapon Animation problem.
by Jason Farmer · in Torque Game Engine · 01/03/2006 (6:57 pm) · 2 replies
I'm working on one of my weapons at the moment.
The basic idea is that when you press fire and release it, the weapon will start to build it's ammunition and then once completed, it will fire, sort of a firing delay.
No problem so far, using the state system I've created my generation state.
Trouble comes when it comes to playing the animation I've created for this process.
I've got a 200 frame long animation (in Milkshape) which plays fine.
Trouble is that the animation seems to be scaled to the StateTimeoutValue of the generate state.
If I set this value to a really small value, the animation plays really quickly... and if I set it to a larger value, it slows the animation down... this wouldn't be a big problem as the animation plays in full as expected.. but the state appears to change halfway through the animation... not what I want really.
There seems to be some other factor scaling the animation differently to the StateTimeout.
Does anyone have any idea why this is happening and what I can do to make this do what I want.. which is basically set up the StateTimeoutValue to the length of animation so that the fire state occurs as soon as it's finished but not before.
I've had a rummage around the docs but can't seem to find anything helpful.
this is a snippet of the weapon code just in case I'm being a bit thick and missing something obvious.
and my Milkshape animation settings are
The basic idea is that when you press fire and release it, the weapon will start to build it's ammunition and then once completed, it will fire, sort of a firing delay.
No problem so far, using the state system I've created my generation state.
Trouble comes when it comes to playing the animation I've created for this process.
I've got a 200 frame long animation (in Milkshape) which plays fine.
Trouble is that the animation seems to be scaled to the StateTimeoutValue of the generate state.
If I set this value to a really small value, the animation plays really quickly... and if I set it to a larger value, it slows the animation down... this wouldn't be a big problem as the animation plays in full as expected.. but the state appears to change halfway through the animation... not what I want really.
There seems to be some other factor scaling the animation differently to the StateTimeout.
Does anyone have any idea why this is happening and what I can do to make this do what I want.. which is basically set up the StateTimeoutValue to the length of animation so that the fire state occurs as soon as it's finished but not before.
I've had a rummage around the docs but can't seem to find anything helpful.
this is a snippet of the weapon code just in case I'm being a bit thick and missing something obvious.
stateName[1] = "Activate"; stateTransitionOnTimeout[1] = "Ready"; stateTimeoutValue[1] = 0.6; stateSequence[1] = "Activate"; // Ready, just waiting for the trigger stateName[2] = "Ready"; stateTransitionOnTriggerDown[2] = "Wait"; stateName[8] = "Wait"; stateTransitionOnTriggerUp[8] = "Generate"; stateName[3] = "Generate"; stateTimeoutValue[3] = 20.2; stateTransitionOnTimeout[3] = "Fire"; stateSequence[3] = "Generate"; stateSound[3] = EMPCannonGenerate; // Fire the weapon. Calls the fire script which does // the actual work. stateName[4] = "Fire"; stateTransitionOnTimeout[4] = "Reload"; stateTimeoutValue[4] = 0.2; stateFire[4] = true; stateRecoil[4] = LightRecoil; stateAllowImageChange[4] = false; stateSequence[4] = "Fire"; stateScript[4] = "onFire"; stateSound[4] = EMPCannonFireSound;
and my Milkshape animation settings are
3 frameRate=30.000000 overrideDuration=-1.000000 priority=1.000000 4 blendReferenceFrame=0 endFrame=200 numTriggers=0 startFrame=1 8 blend=0 cyclic=0 enableIFL=0 enableMorph=0 enableTVert=0 enableTransform=1 enableVis=0 ignoreGround=1
#2
I've tried setting the timeout to all manner of values, Large/Small.. the animation always scales to the timeout. and the weapon skips to the next state half way through animation.. always halfway through.
The weapon is mounted on a (1.2) turret which is mounted on a player.
I think what's happening is the weapon is receiving twice as many ticks as it needs to, so the weapon is counting down through its timeout before the animation finishes.
I think this is a bug I've introduced, although I can't think where.
Luckily, the animation continues to player after state finishes. So I've created a secondary state with the same timesout value which just sits there. Now, the weapon fires after the animation finishes. It's a workaround at the moment.
Anyone using the turret resource noticed this?
On a side note, I'm getting problems getting particles to work on my weapon.
They work fine on the projectile, just not when the weapon is charging. I'm wondering if it's related.
I also get problems with Semi-Transparent faces not rendering on the weapon when mounted on a turret.
Any clues?
01/09/2006 (9:27 am)
Hi Ben, I've tried setting the timeout to all manner of values, Large/Small.. the animation always scales to the timeout. and the weapon skips to the next state half way through animation.. always halfway through.
The weapon is mounted on a (1.2) turret which is mounted on a player.
I think what's happening is the weapon is receiving twice as many ticks as it needs to, so the weapon is counting down through its timeout before the animation finishes.
I think this is a bug I've introduced, although I can't think where.
Luckily, the animation continues to player after state finishes. So I've created a secondary state with the same timesout value which just sits there. Now, the weapon fires after the animation finishes. It's a workaround at the moment.
Anyone using the turret resource noticed this?
On a side note, I'm getting problems getting particles to work on my weapon.
They work fine on the projectile, just not when the weapon is charging. I'm wondering if it's related.
I also get problems with Semi-Transparent faces not rendering on the weapon when mounted on a turret.
Any clues?
Associate Kyle Carter