Calling up SkeletalMesh animation using Matinee

In Kismet, a Matinee action can be used to fire off events in a time-based manner, and an AnimNotify is an AnimTree node that lets us associate AnimTree content with Matinee tracks. For example, you could have a looping animation for a SkeletalMesh walking or idling, then use a Trigger in the scene to fire off a Matinee which swaps in a falling animation to replace the idle. A Matinee can also be used to control Morph target keys.

Getting ready

Load the map template Midday Lighting.

How to do it...

  1. Right-click in the scene and add a Trigger actor on the ground. In its properties turn off the check box for Display | Hidden so it shows during gameplay.
  2. In the Content Browser, locate and right-click on the AnimTree Packt_CharTreeSlotStart and choose Create a Copy and call the copy Yourname.Mesh.TestSlotTree.
  3. Double-click the result, then right-click in the canvas and choose New Animation Node | AnimNodeSlot.
  4. Place this in between the UDKAnimationBlendByPhysics node and the UDKAnimBlendByIdle node, as shown in the next screenshot.
  5. An extra input has to be added to the AnimNodeSlot by right-clicking and choosing Add Input. In the past, an AnimSequenceNode would need to go into the Channel 0 and Channel 1, but now it is no longer necessary to set this. We are going to drive a sequence into these channels in a Matinee. SlotName is not a very inspiring name for a node, but keep it as such, since we need to reference it later. The name SlotName appears in the node's properties under Anim Node | Node Name.
    How to do it...
  6. In the Content Browser, find Packt_SkinTailFBX. Highlight it and right-click in the scene and choose Add SkeletalMeshMAT: Packt.Mesh.Packt_SkinTailFBX. This differs from just dragging and dropping the asset, because there are actually three kinds of SkeletalMesh actors that you can place in the scene. The MAT suffix means this actor can have blending animation driven by Matinee. Set the scale of the actor to 1.25 and ensure it is standing on the ground.
  7. With the Packt_SkinTail actor selected, press F4 and add the necessary Anim Tree Template MyCharTreeSlot (that you just created), the AnimSet Packt_SkinTailAnims, and also the Physics Asset Packt_Character_Physics and Morph target set PacktMorphSet if you wish, as in earlier recipes covering the SkeletalMesh placed directly in the scene.
  8. Note that in the SkeletalMeshMAT properties there is no channel for naming an animation sequence to play. Instead, this is done in the Kismet.
  9. In the SkeletalMeshMAT properties, under the Movement section, set the Physics method to PHYS_Interpolating.
  10. In the scene, select the Trigger actor. In Kismet [ How to do it... ], right-click and choose the New Event Using Trigger_0 | Touch event using the Trigger. Set its Max Trigger Count property to 0.
  11. Next to the Trigger_0 Touch event hold M and click to add a new Matinee, and tick its Looping property. Connect the Touched nub to the Play nub, highlighted below.
    How to do it...
  12. As shown here, with Packt_SkinTail selected in the scene, right-click the Matinee action and choose Open UnrealMatinee. In the Matinee Editor's tracks panel, right-click and choose New Empty Group. Call this AnimTrack.
  13. In the Content Browser, highlight the AnimSet Packt_SkinTailAnims. Back inside the Matinee Editor, click on the AnimTrack we just added then look to its Properties panel; you'll notice there is a channel Group AnimSets. Press the add entry icon [ How to do it... ] to add Packt_SkinTailAnims here. If you don't, you won't be able to add animation sequences to the timeline later.
  14. Right-click on AnimTrack and choose Add New Movement Track. Again, right-click on AnimTrack and choose Add AnimControl Track. You will be prompted to select amongst AnimSlot nodes in your AnimTree. Ours is SlotName. If it's not already there, type SlotName in the properties of the Anim: SlotName track.
    How to do it...
  15. With the Anim: SlotName track highlighted, press Enter to place a key on the timeline or click the icon [ How to do it... ].
  16. You will be prompted to choose a sequence from a pop-up list based on your Group AnimSet Packt_SkinTailAnims. Choose Packt_SkinTailPunch, which is an attacking move.
    How to do it...
  17. You'll notice it fill the timeline with a colored bar. As shown here, right-click on the key in timeline at 0.0s and choose Set Looping. The solid bar will fill the timeline with cycles of the current sequence.
  18. Add another Anim Control Track and key it to add from the pop-up list of animation sequences Packt_SkinTailKick. You can't add more because the AnimTree node SlotName has only been given two Channels. Notice the kick animation is the same base length on the timeline as the punch animation. Right-click on the timeline key at 0.0s and choose Set Looping, as before.
  19. To edit the tracks, click on each tiny gray square icon on the right-hand side of the track labels to access their Curves. The icon will turn yellow. In the previous screenshot, the Curve Editor, you'll see the track's curve. Each curve at the moment displays a line. Adding keys on it, and changing their values produces curves, hence the name.
  20. At about 1.00 on the Punch curve/line press Ctrl + LMB to add a new key. After that hold Ctrl and drag the key to set a value of 1. You can also right-click on any key and choose Set Value to enter a value. Repeat this along the timeline to create an ease in-ease out bell curve for the punch. Create a similar curve by adding keys to the Kick track, but offset it so one turns off while the other turns off. Your result should resemble the next screenshot. For timing, check the beginning and ending frames of the looping sequences. PIE to verify the touched Trigger fires off the animation. Packt_03_AnimTrackDEMO.UDK shows the result.
    How to do it...
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.227.48.131