Forum rules - please read before posting.

Head animation for the player

2»

Comments

  • Hello.
    I have just watch this video, but this is not what I want to do. This video is showing how to animate the parts of the body. What I want to do is the same that the Sprite Unity Complex prefab you did. I want an animation whith several sprites renders which makes invisible the rest of the sprites of the head, just like you have, like this screenshot I already shared https://imgur.com/33IFCRp

  • The video demonstrates how multiple objects can be animated in one AnimationClip, which was the issue you were having, so far as I understood it.

    The difference with the head animations is that instead of animating e.g. body part Transforms, you want to animate the enabled state of your various "Head" Sprite Renderers.

    The AnimationClip in the screenshot you shared was created using the technique in the video, i.e. multiple objects being controlled in a single asset. For each object, the Sprite Renderer component is disabled.

  • nhtnht
    edited March 2022

    I don't really see any relation with what I'm trying to do. In this video this explains how to make animations(tween animations) with the different parts of the body, but I am handling frame by frame animations. And my problem here is that i have all faces (in the 8 positions) together, and I am not able to make just one visible, as your prefab does.

  • Check your prefab. It has all the sprite faces visible.
    How do you make the rest of the sprites invisible? Because I'm trying to do exactly the same.
    https://imgur.com/5f65Hpq

  • The provided Head etc animations all work by enabling the intended Head SpriteRenderer, and disabling all others.

    If you open up e.g. Head_D in the Animation window, you can see that Head_D's SpriteRenderer is enabled, with all others (e.g. Head_L, Head_UR etc) are all disabled.

    If an animation disables a component or GameObject, such changes won't be reflected in the "preview" box at the bottom of the Inspector, but they will take effect at runtime.

    The alternative would be to change the SpriteRenderer alpha values, instead of disabling their components outright - this likely would show up in the preview window.

  • nhtnht
    edited April 2022

    Ok, the thing in the video you provided me
    -how the game knows that "if the character is facing right then show Head R? "
    Because my character is showing all the faces at the same time. It just changes the body animations.
    -how can I turn off the rest of the faces?
    -And how I am able to attach the body animation to the head animation?

  • how the game knows that "if the character is facing right then show Head R? "

    Because my character is showing all the faces at the same time. It just changes the body animations.

    When using Sprites Unity Complex, map the "HeadAngle" float parameter you're using in your BlendTree to the Player component's "Head angle float" field. This will cause AC to update its value - and drive the BlendTree - according to which angle the head is facing.

    how can I turn off the rest of the faces?

    As mentioned above: each Head animation works by enabling the intended SpriteRenderer, and disabling the others. For example, the Head_R animation should enable the Head_R sprite, and disable the other Head sprites.

    And how I am able to attach the body animation to the head animation?

    As in, keep the head fixed to the neck as the neck moves due to body movement?

    Animate the position of the "Head" parent object in your Hierarchy inside your main body animations - the "Head" animations should only control which sprite is shown, not their positions.

  • nhtnht
    edited April 2022

    When using Sprites Unity Complex, map the "HeadAngle" float parameter you're using in your BlendTree to the Player component's "Head angle float" field. This will cause AC to update its value - and drive the BlendTree - according to which angle the head is facing.

    I had already configured in this way and it shows all the faces at the same time. I have also linked Head Angle to the field in AC.
    https://imgur.com/0MOJjoK
    Can you see it?
    In the screen I have the head without helmet being animated while the helmet is over there with all the faces together. Also I have included the screenshoot showing that the body animator controller is being played.
    If I reduce the weight of the layer of the helmet or head, then the body is shown but without the head.
    I don't really know what I am doing wrong. May I send you my prefab? I don't know what else to do.

  • May I send you my prefab?

    That sounds best. There are so many values and Inspectors involved, there'll always be something left out in screenshots.

    PM me a .unitypackage containing the prefab, sprites and animation assets, and I'll take a look.

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.