0
\$\begingroup\$

I'm following this Unity Animation Rigging tutorial by TheKiwiCoder. What I have now is a rig layer containing all kinds of constraints. The tutorial instructs to add an animator to this rig layer and record animation in the Animation window.

animation window screenshot

I recorded a clip, and use code to play it.

public void Equip(Guns newgun)
{
   if (weapon)
   {
      Destroy(weapon.gameObject);
   }
   weapon = newgun;
   weapon.transform.parent = weapon_pivot;
   weapon.transform.localPosition = Vector3.zero;
   weapon.transform.localRotation = Quaternion.identity;
   rigController.Play("equip_" + weapon.Name + "_pose");

}

but even though the transition appears in the animator, it still won't play. Has anyone encountered this type of issue?

screenshot of result

By the way, if I switch up the default like this, it will play the animation, although it doesn't play correctly. So I guess it may have something to do with the configuration?

screenshot of alternate configuration and result

And if i add the transition, it will end up like this (with no transition play at all, even if it shows transition in the animator):

enter image description here

and this:

enter image description here

\$\endgroup\$
2
  • 1
    \$\begingroup\$ The tutorial seems to assume that the viewer is already familiar with the AnimationController and is only there to learn how the rigging system work. Maybe it would be useful for you to properly learn how to use the AnimationController first. It's a very powerful tool, but not very accessible to beginners. \$\endgroup\$
    – Philipp
    Apr 3 at 8:17
  • \$\begingroup\$ i will do that now, that make sense \$\endgroup\$
    – pond
    Apr 3 at 8:24

1 Answer 1

1
\$\begingroup\$

Your animator doesn't have any transitions (other than the default Entry transition). A transition would be represented as a line between states (notice the line from "Entry" to "character_unarmed").

To add a transition:

  1. Right-click on the state you want to transition from.
  2. Left-click on the state you want to transition to.
  3. A new line appears between the states. If needed, click on the line to select it, and adjust the transition settings in the Inspector.

See the official documentation on the Animator Controller and Transitions for more info.

\$\endgroup\$
3
  • \$\begingroup\$ Actually, I already tried to add a transition. If I add the transition as 'character_unarmed' by default, then in the animator, it will show the transition being played, but it actually isn't. If I use 'pistol_pose' as default, it will play the 'pistol_pose' animation at the beginning and get stuck in that state, just like depicted in the above image. In the tutorial, it uses a script to play the animation clip, so there are no transitions directly in the animator. \$\endgroup\$
    – pond
    Apr 2 at 23:23
  • \$\begingroup\$ @pond I'm not sure that I understand what you're trying to say. Please make sure you understand the difference between a state and a transition and use the appropriate term. You have two screenshots of Animator Controllers in your post. Each of those screenshots shows two custom states in the animator, but no transitions between the states. If you're using code to play animations, then you need to show us the code. If you're using the Animator Controller, then you need to add transitions to it. \$\endgroup\$
    – Kevin
    Apr 3 at 2:20
  • \$\begingroup\$ sorry for the confusion, i already edited it. \$\endgroup\$
    – pond
    Apr 3 at 6:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .