No announcement yet.

Assigning an animation for a key

  • Filter
  • Time
  • Show
Clear All
new posts

    Assigning an animation for a key

    So here's the thing
    I understood the animation tree/nodes/sockets and all of those after hours of searching but i missed one important point
    Let's say i have my animation tree set up and my animset called and so on....
    Where in my pawn class is the link function between the animation and the function.

    To put it in a simple manner:
    How can i do this (or at least point me at where are they assigned so i can look there, i searched the pawn class but didnt understand how the animation is linked)
    function punch

    I don't want the PlayCustomAnim('punch', , , ,etc..)
    (I'm not sure but i think its the PHYSIC_ thing but i didnt understan its function)
    Please help

    The easiest way to do this would be to create an exec function in your PlayerInput class.
    exec function ThrowPunch()
       //code for throwing a punch
       `log("I threw a punch.");
    In DefaultInput.ini look for the keyboard bindings section and add a line in there to bind the key to the function.

    Edit: I see this is your first post. Let me just make sure you know that it's a best practice to not mess with the default UDK classes. You should create your own class...
    class MyPlayerInput extends PlayerInput within MyPlayerController;


      Thank you for your reply
      I think i explained myself wrong.

      Is there a way to animate other than:
      FullBodyAnimSlot = AnimNodeSlot(Mesh.FindAnimNode('FullBodySlot'));
      FullBodyAnimSlot.PlayCustomAnim('Animation', 1, 1, 1, false, true);



        Yes. There are an infinite number of ways that you could make an animation play. In the AnimTree editor attach your animation to whatever kind of node you want. Blend it however you want. And call it in your code however you want.

        Maybe for testing purposes, just set up an AnimTree with one of UDK's provided animations (maybe the "bring it on" animation), then reference your AnimTree in your Pawn's skeletal mesh component in default properties, and then in your PlayerController or PlayerInput, make a function to play the animation.

        How about you give that a try, see if it does what you want it to do, and if it doesn't then come back here, show us your code, and we'll see what needs to be fixed.


          Reread your post several times and I am still not sure what exactly are you asking.
          You can code your own animation nodes, which can eventually help you avoid using PlayCustomAnim().

          Maybe if you tell us what are you trying to do, we will be able to help you better.