Sound for non-Matinee controlled animation

In the last example we fired off sounds from the Matinee timeline, but this doesn't allow us to influence the playing of sounds such as player or Bot footsteps that will occur every time an animation sequence plays. In this recipe we will assign sounds directly with animation sequences, allocating them so they are tracked by the AnimSet associated with the character.

How to do it...

  1. In the Content Browser, find and open the AnimSet Packt_SkinTailAnimsAudio. This is just a test copy of the AnimSet that we've been using so far. Once it opens, highlight Packt_SkinTailFWD in the animation sequences list. Look down to the properties panel, and click on the Anim Sequence tab. Here you can expand Anim Sequence and see a channel called Notifies.
    How to do it...
  2. Click on the add entry icon [ How to do it... ] and a [0] will appear that you can expand. Click its blue triangle [ How to do it... ] to select the kind of notify you want to add. For footsteps it might be an AnimNotify_Sound but you may equally require splash particles coming off the feet for watery levels through the use of AnimNotify_PlayParticleEffect. As shown here, in this case, go with AnimNotify_Sound.
  3. You will now be able to assign an asset from the Content Browser. In this case, choosing a footstep cue would be helpful. I chose a default one: A_Character_Footsteps.FootSteps.A_Character_Footstep_DefaultCue.
  4. You will also want to set the Time when the footstep will be fired during the sequence. Once this is set, you can drag the marker in the preview to change it.
  5. Set the bone the Notify is related to (especially if you are sending off particle effects, as for sound it doesn't matter much). In this case I used b_LeftToe as that is the end of the leg chain, and at 0.0s that is the model's ground contacting joint.
  6. You can add another item to the Notifies list by clicking the add entry icon [ How to do it... ] again, and repeating these steps to create a right foot step sound for b_RightToe at about 0.7s.
    How to do it...
  7. It helps to add a Comment like Left foot and Right foot to each item, as these show up on the AnimSet preview timeline.
  8. When playing games, once in a while you may have noticed hidden characters walking in the scene with audible footsteps. In the properties, there is a check box to eliminate the chance of this called Ignore if Actor Hidden. Still, there might be some cases where you want this spooky effect.
  9. When you assign each AnimNotify_Sound you might have noticed in the list that there are plenty of other kinds of Notify available. Assigning them and checking through their properties would be a good way to familiarize yourself with what they offer. One in particular that is relevant here is the AnimNotify_FootStep. This has a preset foot down channel with a value of 0 for Left and 1 for Right, so once you add one AnimNotify_Footstep entry you've covered the requirement for stepping sounds. However, you may notice that there is no SoundCue set here, which is because it must be set in the custom pawn class for a given character. The benefit of this is that you could add some kind of array for different sounds to play when walking on different surfaces or when wearing different shoes, or at different movement speeds and so on.
    simulated event PlayFootStepSound (int FootDown)
    {
    local SoundCue FootSound;
    FootSound = SoundCue'YOURPACKAGE.GROUP.YOURSOUNDCUE'
    PlaySound(FootSound, false, true,,,true);
    }

See also

This chapter has covered a wide range of Material, from 3ds Max asset handling, to Kismet, Matinee, and UnrealScript basics.

  • For more information on Kismet, see Chapter 4, Got Your Wires Crossed?
  • For more information on UnrealScript, see Chapter 6, Under the Hood. This chapter deals mostly with configuration. It is not a deep guide to UnrealScript, but some of the content there may help make entering code feel a bit more friendly.
..................Content has been hidden....................

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