Forum rules - please read before posting.

Defining a new input

I have a feeling this has a simple answer, but I'm unable to solve it.

I'd like to have custom key/input trigger a mecanim animation (e.g. the space bar press triggers a "punch" animation). Here's what I did:

1. Defined a new input in Unity's input manager as "Punch" with "space" as positive
2. Added a Boolean parameter "Punch" in Unity's animator
3. Added a transition from any state to with Punch condition true to the animation

Hit play. Hit space. Only the Idle's blendtree is playing.

Any idea what I'm doing wrong? Thank you.

Comments

  • You need to create a link between the Input you've created and the boolean parameter - them being the same name is not enough.

    For a true fighting system, you'd probably want to write a dedicated script to handle this, but you can create a simple such link by using Active Inputs (see section 2.14 of the Manual) - you can use one to map the Punch input to trigger an ActionList that contains a "Character: Animate" Action to affect your player's Punch boolean value.  A very similar example involving a crouch button is covered in the 2.5D tutorial.
  • Thanks Chris. I missed that part of the manual! It's working for me now and makes sense, and also this thread helped:


    R
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.