Boothand Posted March 30, 2017 Share Posted March 30, 2017 Doing an experiment for someone, trying to trigger a saber animation on keypress. ps.saberBlocked = BLOCKED_TOP, for instance, instantly snaps Kyle into the pose. In multiplayer there was some blending actually when doing this.I tried PM_SetAnim because I saw it had a parameter for blend time, but same behaviour as above.Saw references to animation blending with the SetBoneIndex G2API stuff, but didn't want to touch that. Calling from ClientThink_real in g_active for now. Is there a reasonable way to blend to a saber pose? @@MGummelt Archangel35757 likes this Link to comment
MGummelt Posted March 31, 2017 Share Posted March 31, 2017 Blocked_top probably is a really short animation, may not be able to blend to it? Though I suppose you could blend out of the old and and into the single frame of the new anim. I don't really remember much about the inner workings of the anim system when it gets down into Ghoul blending them, etc. I know we had a few commands to play specific animations in JKA, like crouch, spin your saber, taunt, etc. Look at the G_SetTauntAnim() function in g_cmds.cpp. You'll see it's called by ClientCommand when you enter a command on the console (or bound to a key) like "taunt", "bow", "meditate", "flourish", "gloat". You should be able to just add your own command that calls G_SetTauntAnim() with a different animation of your choosing. Boothand likes this Link to comment
Boothand Posted March 31, 2017 Author Share Posted March 31, 2017 Blocked_top probably is a really short animation, may not be able to blend to it? Though I suppose you could blend out of the old and and into the single frame of the new anim. I don't really remember much about the inner workings of the anim system when it gets down into Ghoul blending them, etc. I know we had a few commands to play specific animations in JKA, like crouch, spin your saber, taunt, etc. Look at the G_SetTauntAnim() function in g_cmds.cpp. You'll see it's called by ClientCommand when you enter a command on the console (or bound to a key) like "taunt", "bow", "meditate", "flourish", "gloat". You should be able to just add your own command that calls G_SetTauntAnim() with a different animation of your choosing. Long story short, turns out PM_SetAnim actually does use blending, and I can't possibly remember what I did wrong yesterday (I found out by checking G_SetTauntAnim which ultimately called NPC_SetAnim, which is very similar to PM_SetAnim, so running G_SetTauntAnim does the same thing as running PM_SetAnim with blendTime 100). It turns out that when I increase the blend time above 100 (the default), it starts off blending into the animation slower like expected, but snaps into the final frame of the animation after some time. It's not a huge problem to use 100, but makes it a bit less 'smooth' than I'd like. Blend time 500: Blend time 100: Same result with other animations (that have more than a single frame). Might have something to do with the duration of the animation? I don't expect there to be a simple solution, but leaving this here for reference either way. PM_SetAnim(&pm, SETANIM_TORSO, BOTH_P1_S1_T_, SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD, 100); //values above 100 causes him to snap into the final frame too early Link to comment
MGummelt Posted April 6, 2017 Share Posted April 6, 2017 Long story short, turns out PM_SetAnim actually does use blending, and I can't possibly remember what I did wrong yesterday (I found out by checking G_SetTauntAnim which ultimately called NPC_SetAnim, which is very similar to PM_SetAnim, so running G_SetTauntAnim does the same thing as running PM_SetAnim with blendTime 100). It turns out that when I increase the blend time above 100 (the default), it starts off blending into the animation slower like expected, but snaps into the final frame of the animation after some time. It's not a huge problem to use 100, but makes it a bit less 'smooth' than I'd like. Blend time 500: Blend time 100: Same result with other animations (that have more than a single frame). Might have something to do with the duration of the animation? I don't expect there to be a simple solution, but leaving this here for reference either way. PM_SetAnim(&pm, SETANIM_TORSO, BOTH_P1_S1_T_, SETANIM_FLAG_OVERRIDE | SETANIM_FLAG_HOLD, 100); //values above 100 causes him to snap into the final frame too early Yeah, if the blend time is longer than the animation, it wouldn't surprise me that it snaps to the last frame prematurely. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now