playMaker

Author Topic: Combining animation data?[SOLVED]  (Read 19074 times)

Red

  • Hero Member
  • *****
  • Posts: 563
Combining animation data?[SOLVED]
« on: July 22, 2012, 07:27:59 PM »
I've been reading up on the blend-animation action (and the related animation actions) but i'm not 100% sure that what i'm aiming to do is do-able with this set.

what i'm hoping to do is to create animations that can be isolated and merged together... so, having a walk cycle in a few frames (and the upper torso in a non-moving/neutral pose) and having (for example) the "holding a weapon" animation on the upper torso..... and blend them together so that the walk cycle and the weapon animations are together. so that when i blend the "attack" animations with the "movement" animations, there's no odd visuals.

hoping that this is do-able since it would mean that there would be a LOT more flexibility of animations (so, i could isolate the moving animations and the attack animations and tell Playmaker to manage them accordingly.)

Am i missing something important here? is this primarily a unity3D kinda thing?
« Last Edit: July 03, 2013, 01:57:37 AM by jeanfabre »

artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 318
Re: Combining animation data?
« Reply #1 on: July 25, 2012, 09:08:00 PM »
I believe you would do that via Mixing Transforms.  I have been using them for several months, and I have never gotten them to work even once.  I still can't tell if this is a PlayMaker issue or my own, but for all the combinations of events and scripting reference I've messed with, I think it's a broken action. 

Bug Alex, maybe? 


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Combining animation data?
« Reply #2 on: July 26, 2012, 04:59:24 AM »
Hi,
 
Not really acquainted with animation blending and all that, but  If you can find a working example using just scripts, I can then rebuild it all with playmaker, and thus we would be able to extract a working system. If I have a working source, then I can do it without problem.

Bye,

 Jean

PlatinumPlayer

  • Playmaker Newbie
  • *
  • Posts: 26
Re: Combining animation data?
« Reply #3 on: July 26, 2012, 11:47:20 AM »
You need to set animation weight for the animations and this unity article will explain simply how to use it. I have already tried it and used it. However i'm not sure why i need the set the weight every frame for it to be effective. Can't it be set as a base value? I think a new playmaker action needs to be made to make this a property that doesn't need set every frame.

Oh! And make every higher level animation 'additive' blend, instead of blend. The lower animations should be set to blend blend to the higher animation.
« Last Edit: July 26, 2012, 11:59:05 AM by PlatinumPlayer »

artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 318
Re: Combining animation data?
« Reply #4 on: July 26, 2012, 12:23:34 PM »
That covers animation blending, but what about the Mixing Transform?  I have had blending work as well, but I got the impression that Red's needs were similar to where I got stuck, which was isolating and combining multiple animations.

Thank you guys for your input and time.

PlatinumPlayer

  • Playmaker Newbie
  • *
  • Posts: 26
Re: Combining animation data?
« Reply #5 on: July 26, 2012, 01:46:32 PM »
This is exactly how its done.

Example:
Layer 0 Idel, Walk, strafe left, right
Layer 1 Weapon held
Layer 2 Weapon attack

Now layer 0 dose not need weight set...
Set both layer 2 and 1's weights to .5 (example you need to tweek it based on animation)

So by default when you move without a weapon all your movement animations run unblended.
When you have a weapon play the weapon held animation. because its weighted the weapon held animation will play over top of all layer 0 animations. So if you strafe, run forward or back, your upper body should hold the weapon properly.

Now when you attack with weapon attack on layer 2, its weight is before weapon held, so i overrides weapon held if they share the same slot, and weapon held will blend into attack, all the while bellow it all your movement should stay seamlessly responsive at the bottom of the layer stack.

I have already dose this in a turret defense turret. The top cap of the turret is always rotating (its idle animation. could just as easily be a characters run animation), and it has two laser cannons attached to the side of its body (not the cap). When the turret attacks theses cannons animate a recoil that dose not interfere with the caps rotation because they are on different levels and are weighted.

Isn't this the very effect red is looking to achieve?

artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 318
Re: Combining animation data?
« Reply #6 on: July 26, 2012, 05:49:57 PM »
I don't know if that is what Red is looking for exactly, but I just did a test in my project and it doesn't function exactly as you say.  The correct animation plays over the top of the characters movement, but the characters movement animation either stops or blends to the idle animation and then back. 

I tried setting the Layer 1 animation to different weights between 0-1, but nothing worked as you say.

Setting Layer 1's animation to be Additive instead of Blend causes the animation to go crazy.

I know this is Reds thread but I'd really appreciate it if you could help me solve what seems to be the same issue.  Here's a screencap of my "attacking" state:


For what it's worth, I was always told Mixing Transforms were the way to do this, since you're essentially isolating a portion of the skeleton to play another animation. 

Thanks.

Red

  • Hero Member
  • *****
  • Posts: 563
Re: Combining animation data?
« Reply #7 on: July 26, 2012, 06:15:28 PM »
Aaaah okay! i wasn't sure what those were (nor the terminology... yes, i'm still relatively new to all this.)

i'm going to see about tackling those actions... and if i can get something to work, if i can find some screencasting software (as my trial period for camtasia has expired) i'll put something together for the youtube videos.

though, since this IS a learning experience for me, i would probably want to test this out first (and i'd have to finalize the animations on the character i'm working on to get them to do what i want them to.)

Red

  • Hero Member
  • *****
  • Posts: 563
Re: Combining animation data?
« Reply #8 on: July 26, 2012, 07:04:09 PM »
As for the scripting to use for making animations and being able to merge/blend different animations, this is what i've found in the unity manual... not sure how useful that'll be but it's still a start...

http://docs.unity3d.com/Documentation/Manual/AnimationScripting.html

PlatinumPlayer

  • Playmaker Newbie
  • *
  • Posts: 26
Re: Combining animation data?
« Reply #9 on: July 26, 2012, 07:25:53 PM »
I don't know if that is what Red is looking for exactly, but I just did a test in my project and it doesn't function exactly as you say.  The correct animation plays over the top of the characters movement, but the characters movement animation either stops or blends to the idle animation and then back. 

I tried setting the Layer 1 animation to different weights between 0-1, but nothing worked as you say.

Setting Layer 1's animation to be Additive instead of Blend causes the animation to go crazy.

I know this is Reds thread but I'd really appreciate it if you could help me solve what seems to be the same issue.  Here's a screencap of my "attacking" state:


For what it's worth, I was always told Mixing Transforms were the way to do this, since you're essentially isolating a portion of the skeleton to play another animation. 

Thanks.


Change the weight to something higher then 0, try .2-.5 and change the animation settings blend type to additive. That should fix all the issues.

artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 318
Re: Combining animation data?
« Reply #10 on: July 26, 2012, 07:31:19 PM »
Unfortunately, like I said in my text, that didn't make a difference.  I dont know what the issue was there.

However there is some happy news, I actually got it working with Mixing Transforms.  Stupidly, (though I reserve the right to call all my friends who looked at this and missed the issue stupid too!!!  ;) I didn't input the full path-name to my mixing transform (bone).  I had only input the bone name.  very stupid of me. 

Anyway, thanks for that.  It turns out that the Mixing Transform approach probably is what Red wants to use.

I believe the reason you see better results using blending, PlatinumPlayer, is because you're not seeing animated characters.  I could be wrong (usually am!) but maybe the organic nature of character animation makes the shortcomings of blending additively stand out more, whereas your turret movement and recoil animations are much simpler, no real animation curves, etc.

At any rate, this puts to bed an issue I have had for a better part of 6 months.  Thanks for everyones help.




Red

  • Hero Member
  • *****
  • Posts: 563
Re: Combining animation data?
« Reply #11 on: August 01, 2012, 02:58:51 PM »
okay, i'm asking this here since i've not found an answer that helps me elsewhere.

when you're setting up the asset to animate with this blending/layer system, how do you isolate various body-parts to tell it what to animate and what not to animate?

for instance... i want to find a way of taking the walk cycle and stripping out the upper body parts... same with the "walking/running/firing the weapon" animations (stripping out their lower torso so that the leg movement won't blend over the walk/run/idle animation data.)

if you need me to try and explain it a bit better, let me know... i just need to figure out this before i can go forward with the rest of this particular issue.

artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 318
Re: Combining animation data?
« Reply #12 on: August 01, 2012, 04:34:56 PM »
Now that I've drudged through the process so much I can probably help you quite a bit.

As you probably know, character skeletons are a hierarchy.  In order to isolate one part of the skeleton for exclusive animation, you need to identify the node/bone that this animation will be allowed to control up to, and assign a Mixing Transform to that bone.

In the scenario you outline, you want to combine the movement animation (walking) with the interaction animations (attacking). 

Tell your character to play the movement animation under whatever conditions are necessary (when Joypad up is pressed, etc).  That much of this process is the same as the normal workflow. 
Then identify the highest bone in the hierarchy that the attacking animation should be allowed to control.  In my case it was the shoulder, because my character was swinging a weapon around and all I needed was the arm motion. 

To mix the animations together, assign a Mixing Transform to the bone where you want the new animation to stop affecting the characters (and be sure to put the whole path in, which turned out to be my latest stupid mistake), so you should end up with a Mixing Transform assigning an animation "Attack" to a specific bone in the hierarchy: "pelvis/spine/ribcage/rightShoulder".

When the conditions for playing the Attack animation are met, the animation will take over every bone on the character starting at the node you specified for the Mixing Transform, as well as all child bones(so in my case, the bones: rightShoulder, rightBicept, rightForearm, and rightHand will play the Attack animation, while the rest of the skeleton continues to play whatever other animations are appropriate.)

I could probably clarify this much better, so let me know if that doesn't make sense.  I'll send you a screen cap of my FSM for this too, if that helps.

Regards.

Red

  • Hero Member
  • *****
  • Posts: 563
Re: Combining animation data?
« Reply #13 on: August 02, 2012, 08:13:29 AM »
That is very helpful, thank you! i think i've gotten this down (now to execute it) but i'm curious... i'm aiming for an as compact as i can manage it sort of system... do you think it would be worth considering to give these animation mixing transforms globally accessible events so that the main animation controller (which is stored at the root of the heirarchy) is sending events to the specific bones to control these motions?

i'm going to see about isolating the walk cycle first... and this also means i might have to adjust the rig i've made (i've been making my own rigs... mainly because that's what i've focues my training on mostly.) i can imagine that if one wants to separate the lower from the upper torso, i'd have to make sure that the rig heirarchy branches out in the appropriate areas (i have one main rig node that controls the entire body which has children attached that control the upper and lower torsos respectively.)

i might want to see a screenshot though... also to help those that might also be facing this sort of issue... but if this works out, at least it'll be one more milestone met, so my sincerest thank you. not sure if i'd have been able to figure this out on my own :P

artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 318
Re: Combining animation data?
« Reply #14 on: August 04, 2012, 01:44:53 AM »
That is very helpful, thank you! i think i've gotten this down (now to execute it) but i'm curious... i'm aiming for an as compact as i can manage it sort of system... do you think it would be worth considering to give these animation mixing transforms globally accessible events so that the main animation controller (which is stored at the root of the heirarchy) is sending events to the specific bones to control these motions?

Well, all you're really needing to do is to call the animation as you would normally.  There's no need to send any event to the bone itself, let alone have a script on it.  You can set the Mixing Transforms up beforehand in whatever state initializes your character.  So whatever states you usually call your animations in (sounds like the root transform), just tell it to play "animation X" and the Mixing Transform will isolate the animation at the previously specified point.

Does that make sense? 

Quote
i'm going to see about isolating the walk cycle first... and this also means i might have to adjust the rig i've made (i've been making my own rigs... mainly because that's what i've focues my training on mostly.) i can imagine that if one wants to separate the lower from the upper torso, i'd have to make sure that the rig heirarchy branches out in the appropriate areas (i have one main rig node that controls the entire body which has children attached that control the upper and lower torsos respectively.)

You actually don't have to do anything abnormal like this.  Most skeletons parent bone is the hips/pelvis.  You don't actually need to "isolate" your walk cycle because it will be playing a lower-priority layer.  So basically make your base-level animations use the default (0) Layer (walking, running, jumping), then when you're setting up your animation to be played with the Mixing Transform, make sure it uses a higher layer than default (like 1).  It will blend in right over the top of your movement animations without a noticeable hitch.

So, did you still want a screencap or a helper?  I can send you an example FSM if you want.  Sorry I didn't reply sooner!