• Anybody know anything about poseparameters?
    11 replies, posted
So far I have found out that a poseparameter is a command that you give the QC, so that when a lua command is executed, the model jumps to a certain point in the timeline. Or something like that. I've looked around the web and the wiki, but it doesnt seem to be very well documented. Can anyone help me to get this to work or even just give me a bit more info on it and how it works?
Basically, pose parameters let you blend between one animation and another, under the name of one sequence (ie, L4D's common infected run animation has pose parameters for side movement and forward movement that can be adjusted depending on where the infected's running)_. You can use them in Lua with entity:SetPoseParameter( name, value ). To see how it's done, decompile the male_shared.mdl and look at the run animation.
I'll happily help you out. You basically take 'snapshots' of your animation in certain positions (and export each as a different smd.) Then you blend them all in one sequence and specify which poseparam it runs off of. Here's an example: (I made 3 smd's that specify the model's idle position, when it's turning to the right, and turning to the left. named left.smd idle.smd right.smd) [code]$poseparameter yaw -90 90 //this creates your poseparam, but it does nothing at the moment. $animation idle "idle.smd" //This animation is there so we can subtract other animations from it, that way we can play sequences on top of eachother. $animation aim_idle "idle.smd" subtract idle 0 //These three animations specify the three 'snapshots' you want to tween. $animation aim_left "left.smd" subtract idle 0 $animation aim_right "right.smd" subtract idle 0 $sequence aim_yaw { aim_left aim_idle aim_right //These three animations are what's being blended together and in what order. blendwidth 3 //This tells the compiler how many animations are being blended. blend yaw -90 90 //This assigns the poseparam 'yaw' to control the animations. autoplay //This causes the sequence to play no matter what. realtime //This makes the sequence frame rate independent. delta //This lets it play over the top of other animations, you must use subtract to make them play correctly. hidden //This hides the animation from other developers so they won't see it in hlmv. }[/code]
Okay, I think I understand it now. I'll give it a go and report back here, thanks. Also, is the idle.smd a reference SMD and the left.smd and right.smd Sequence SMDs? or are they all Sequence SMDs, and I need an extra ref.smd which is a reference SMD for the actual model? [B]Edit:[/B] Nope, nothing. Here's my .qc [code]$modelname "boxtest.mdl" $scale 1.00 $cdmaterials "models" $body "Body" "D:\Users\Alex\Documents\3dsmax\scenes\Box\Box.SMD" $poseparameter yaw -90 90 $animation idle "D:\Users\Alex\Documents\3dsmax\scenes\PoseParamTest\idle.smd" $animation aim_idle "D:\Users\Alex\Documents\3dsmax\scenes\PoseParamTest\idle.smd" subtract idle 0 $animation aim_left "D:\Users\Alex\Documents\3dsmax\scenes\PoseParamTest\left.smd" subtract idle 0 $animation aim_right "D:\Users\Alex\Documents\3dsmax\scenes\PoseParamTest\right.smd" subtract idle 0 $sequence aim_yaw { aim_left aim_idle aim_right blendwidth 3 blend yaw -90 90 autoplay realtime delta hidden } $surfaceprop "metal" $collisionmodel "D:\Users\Alex\Documents\3dsmax\scenes\Box\Box.SMD" { $concave $mass 100.000 } [/code]
All SMDs used for the sequences should be sequence SMDs. However, as the reference SMDs include all the data needed for a sequence SMD you can use a reference SMD for the idle SMD as you do not require it to move. The SMD for the model ($model/$body in the QC) must be a reference SMD as only reference SMDs contain the vertex data needed for the mesh. Though technically you could put an animation into a reference SMD as it supports multi-frame skeleton data as sequence SMDs do, and if you look at the values in any decompiled reference SMDs you will see they have a 30 frame idle anim in it for no good reason. (I've been researching SMD format for the past few days so I have a pretty good idea how they work now ^^).
Thanks for the info there. I have tried compiling with the QC as above, but no animation plays in HLMV, and there are no sequences in the drop down box. There is however a yaw control slider, which leads me to believe that the poseparameter worked correctly. Any idea why the above QC doesn't work?
Try making another $sequence, like this: [code]$modelname "boxtest.mdl" $scale 1.00 $cdmaterials "models" $body "Body" "D:\Users\Alex\Documents\3dsmax\scenes\Box\Box.SMD" $poseparameter yaw -90 90 $animation idle "D:\Users\Alex\Documents\3dsmax\scenes\PoseParamTest\idle.smd" $animation aim_idle "D:\Users\Alex\Documents\3dsmax\scenes\PoseParamTest\idle.smd" subtract idle 0 $animation aim_left "D:\Users\Alex\Documents\3dsmax\scenes\PoseParamTest\left.smd" subtract idle 0 $animation aim_right "D:\Users\Alex\Documents\3dsmax\scenes\PoseParamTest\right.smd" subtract idle 0 $sequence idle01 "D:\Users\Alex\Documents\3dsmax\scenes\PoseParamTest\idle.smd" loop fps 1 $sequence aim_yaw { aim_left aim_idle aim_right blendwidth 3 blend yaw -90 90 autoplay realtime delta hidden } $surfaceprop "metal" $collisionmodel "D:\Users\Alex\Documents\3dsmax\scenes\Box\Box.SMD" { $concave $mass 100.000 }[/code] Otherwise the qc looks fine, if it doesn't work; your animations must be bad. If you upload them somewhere i'll dissect them for you. And tell you what went wrong.
Thanks, I'm at work right now, but i'll try that as soon as I get home and let you know what happens. [editline]12:27PM[/editline] It's working now. Brilliant, thanks! [editline]12:35PM[/editline] Except when I assign the model a poseparameter using [code]lua_run Entity(1):GetEyeTrace().Entity:SetPoseParameter("yaw",90)[/code] the animation plays till 90, then jumps back to 0 and plays again. Is there any way to stop this?
[QUOTE=Chipstik;24818669] Except when I assign the model a poseparameter using [code]lua_run Entity(1):GetEyeTrace().Entity:SetPoseParameter("yaw",90)[/code]the animation plays till 90, then jumps back to 0 and plays again. Is there any way to stop this?[/QUOTE] Try removing "autoplay" from the qc.
Don't do that. ^ I'm not sure what the problem is but removing autoplay won't fix it.
The poseparameter will be set with Lua, so maybe theres a way to check when the poseparameter is at 90, then pause it? (but thats nothing to do with me, its just a suggestion :P)
What would you need if you wanted a turret that can rotate 360 degrees on the yaw? Would you need 4 animations for front, left, right, and back? EDIT: Just tried on my own with one facing -180 and the other facing 180 and idle in between. Although on the pitch, it seems to be amplifying the angles in the SMD by a factor of 2. Where I put 45 degrees, it rotates it up and down 90. Anyone know why that might be? [code] $poseparameter pitch -90 90 $poseparameter yaw -180 180 $animation idle "deckgun_idle.smd" $animation aim_idle "deckgun_idle.smd" subtract idle 0 $animation aim_up "deckgun_up.smd" subtract idle 0 $animation aim_down "deckgun_down.smd" subtract idle 0 $animation aim_left "deckgun_left.smd" subtract idle 0 $animation aim_right "deckgun_right.smd" subtract idle 0 $sequence aim_pitch { aim_up aim_idle aim_down blendwidth 3 blend pitch -90 90 autoplay realtime delta hidden } $sequence aim_yaw { aim_right aim_idle aim_left blendwidth 3 blend yaw -180 180 autoplay realtime delta hidden } [/code] Yes, I know it says -90 and 90 here, but it goes up and down 45 in the SMD. I used -90 and 90 so that when it overcorrects, it actually becomes accurate again.
Sorry, you need to Log In to post a reply to this thread.