Forum rules - please read before posting.

Jumping animation movement

edited February 2019 in Technical Q&A

I want to make a bunny character with specific movement animation and have a couple question for it.

First of all I need a advise which animation style will be the best for it (im thinking about Mecanim)

Second of all the movement should be perform only when my character animation is above the ground.

I made an prototype of my game using Spine for animations and using Spine events to detect when my character jump and land on the ground during animation, but I know that Adventure creator doesn't have official support for it.

Maybe someone have similar problem.

My protype to show what I want to obtain (there is some problems with character rotation but I hope you got an idea):

Comments

  • Welcome to the community, @Expiredmind.

    Though unofficial, a user-made Spine integration can be found on the AC wiki.

    As for the problem at hand, unless you want to incorporate a custom motion or animation controller, I'd recommend relying on "Sprites Unity Complex" animaton mode. This is the better option over "Sprites Unity" whenever your character has any complexity or irregularity.

    This is similar to the Mecanim mode, in that you rely on Animator parameters to drive animation, but also provides parameters for e.g. the facing direction angle - which is necessary for 2D characters. You can learn more about this mode in the Manual's "Character animation (Sprites Unity Complex)" chapter.

    There is, however, a separation between the animation engine and the character's motion. How the character animates will be independent of the way they move. But relying on Sprites Unity Complex allows you to more easily incorporate your own scripts. For example, you could make use of Unity Animation events to control your character's Walk speed scale value (which affects the motion speed), i.e.:

    public AC.Char characterToControl;
    public float normalWalkSpeed = 1;
    public float reducedWalkSpeed = 0.1f;
    
    public void AllowMovement ()
    {
        characterToControl.walkSpeedScale = normalWalkSpeed;
    }
    
    
    public void PreventMovement ()
    {
        characterToControl.walkSpeedScale = reducedWalkSpeed;
    }
    

    If you placed your Animator on the character's root object, I believe you should also be able to incorporate the Player component's "Walk speed scale" directly into your walking animation(s).

  • Thanks for reply, i need some time to test it out. I found this unofficial fan spine integration but unfortunatly its not compatible with the newest AC and Spine :/. I try to use your example Sprites Unity Complex demo and play my spine animation depending of which motion animation is currently fire, but Im not sure that I understand that logic correctly. The character is firing animation depending of FacingAngle.For example I need to turn my character for 180 degrees and he need to fire 4 animations to turn to desired animation. Is he fire only one frame of every animation until he obtain the last one and start move in correct direction? Sorry for my english i hope that you understand my explanations :)

    https://imgur.com/a/evILhvm

    I found this video, but this is mutch simpler case because he can move only with 2 direction so he use only one animation for the state. I dont now if its possible to fire some script method whenever single motion animation is firing (you can look on the screen above and I want to fire function whenver PlayerWalk_D or PlayerWalk_DL etc. is firing).

  • I need to turn my character for 180 degrees and he need to fire 4 animations to turn to desired animation. Is he fire only one frame of every animation until he obtain the last one and start move in correct direction?

    How many frames of each animation will play is dependent upon the character's turn speed, but the behaviour is down to the way Unity's Animator system works.

    If you're trying to create a "turning while walking" animation, you may need to look into making use of the "Turn float" parameter listed in the Player's Inspector. This'll be -1 when turning left, and +1 when turning right, so you can use that - coupled with the facing angle - to add 2D turning animations.

    I dont now if its possible to fire some script method whenever single motion animation is firing

    Reading the state of a BlendTree isn't specific to AC, so you should be able to get some information on the Unity forums. It may be easier, however, to read AC's Player component values - since it provides variables to get the character's state, i.e.:

    AC.KickStarter.player.charState

    AC.KickStarter.player.GetSpriteAngle ()

  • Thanks for your suggestion the AC.KickStarter.player.GetSpriteAngle() was the solution of my problem :). One last thing I want to increase walk threshold to prevent my character of jumping in the same spot when the distance left is quite small. I saw that in the past settingGameManager has variable walk walk Threshold . Can I found smth similar on AC or I need to search how to do it in pathinding engine script and make some statement ?

  • You can reduce the Settings Manager's Destination accuracy slider to increase "how close is close enough" when it comes to pathfinding, but it's a global setting and will affect all characters.

    What you could do is try hooking into the OnCharacterSetPath custom event, which is triggered whenever a new pathfind begins.

    With the Paths parameter that gets passed, you could feasibly read the distance between the first and last "nodes" positions, decide if they're too close, and cancel the pathfind with EndPath().

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.