Forum rules - please read before posting.

2D Character (without Up and Down Animations) is walking backwards

Hi there! 
I've got a question: I have a 2D Player Character without Walking Up and Walking Down Animations, only Walking Left and Idle Left. I use these 2 Animation states for everything. 

My problem now is that in some cases my character is walking backwards (= Walking left is played although Walking right should be played) when I move him upwards in the scene. This can best be seen in this gif:
image
Is there a way to fix this, e.g. to tweak some "Player is moving upwards" values? I've tried a lot of things, even adding all mirrored Animations by hand and disabling the "Frame Flipping: Right mirrors Left" setting. 

Thank you very very much!

Comments

  • If you want full control over your character's animation (to e.g. limit animation to just left and right), try using Sprites Unity Complex as your player's animation engine.

    Sprites Unity Complex allows you to build your own Mecanim FSM based on parameters that AC will send to it (e.g. a "Move speed" float).  One of these parameters is the angle that they're facing: therefore you can make an FSM that plays right-facing animations if the angle is between 0-180, and left if 180-360.  (The angles might be the wrong way around, but you get the idea)
  • Thanks Chris, I'll try that!
  • edited February 2015
    Is there somewhere a good tutorial on this Sprites Unity Complex thing? I tried to use Chapter 3.9 from the AC Tutorial, but I didn't get it working. In the tutorial section I found nothing about the Complex Animations in particular. thx!
    Edit: A perfect case of rubber ducking: After I submitted the question, I tried it again and  - surprise - now it worked. Sometimes i have the feeling Unity makes strange things when one is messing around with prefabs. After restarting Unity again, things worked that didn't work before. 

  • If you have an example or Tutorial with Sprite Unity Complex, it could be great. I think my animator is not correct (My player doesn't play any animation except default)). I followed the manual (parameters in animator, name parameter in inspector) but something should be wrong with my transitions...
  • Hi! I don't know any tutorial yet, but I can show you how I've set up my player character. It's relatively simple, I hope it helps you:
    image
  • Woh, thanks, I will check where I was wrong.
  • Now it works! Thank you!
    I have only 1 issue: Idle down is ok, but not Idle walk down. Angle parameter is set to "less than 45" and "greater than 315". Any idea? It's ok with Right, Up and Left.
  • You're welcome! Sorry, haven't tried out up and down animations yet :(
  • And I have some issues with others animations if Angle is not set exactly by default, like "45-135" for walk-left , strange.
  • @RedCityNoise: You can rely on a direction integer instead of an angle parameter, if you prefer - see the manual's section 3.9.
  • Thanks! But I would like to use Angle because I've got an issue with diagonales (it plays UP-LEFT but it should be UP for example).
  • Examine your Animator controller while it's running in-game.  You'll be able to see the angle parameter's value as you move around, which will tell you what to set the transitions as.
  • Anyone ever happen to write a tutorial on this? i took a look at the manual & section 3.9 but.. yea.. dont get it =) / =(
  • edited September 2016
    What have you done so far, and what are you looking to use - the direction integer (0-7) or the angle float (0-360)?  Screenshots will help to understand where your problem lies.
  • edited October 2016
    Ultimately I understand how it should work by checking the angle and flipping the sprite accordingly when going up or down which ever direction but...

    I cant seem to get conditions and other menus/options to show up when switching to sprites unity complex for some reason. Didnt have options to tweak condition values (angle/speed) parameters like whats on the right side of this screenshot http://humepage.at/upload/AnimationSettings.png

    I tried using my existing set up from sprites unity & changing to sprites unity complex then trying to figure it out based off of 3.9 and that screenshot someone else posted and then tried starting over from scratch when i couldnt get that to work. I can import my animations my idle/walking and see them in animator but as far as linking stuff up with the anystate/entry/exit etc.. Just dont understand how to do it in order to set it for up and down movement for just using the existing left/right sprites (which in my case was just being flipped). Not to mention i dont seem to have conditions to change the less/greater angle even if its added to animators parameters which is weird. 

    I private messaged someone else that posted in this forum and seems like they never figured out how to set up movement with no up/down sprites using sprites unity complex either.

    Id take a screenshot but i deleted and reverted to sprites unity because I just couldnt figure it out even in the slightest bit. I mean maybe the idle animation worked but prob just cause it was the default animation. 

    For now i just turned on diagonal sprites and made diagonal sprites which are the exact same as my left/right sprites which helped a little bit with up and down movement and the player facing the proper direction but its not ideal and still wonky. 


    Basically Id need someone to walk me through it step by step since i tried to look at some unity vids on using animator/animation for sprite unity complex and player movement, but didnt work especially since like i said i seem to not be able to access some of the conditions/parameters etc.. 

    Anyways sorry for the crazy long explanation.. I am hoping a programmer friend can maybe hard code in an angle thing for the player sprite movement or knows how to use sprite unity complex to do it. Otherwise i honestly think id need a step by step tutorial from the absolute start and don't expect you to do that and I mean you sorta did with 3.9, but i am obviously dense.


  • So that screenshot isn't from your own set-up?  If your Animator inspector looks different, it may be that you're using an older version of Unity.

    The forum is here to help those with problems, of course - but being a more complex animation type, it does require a knowledge of how
    Mecanim works beforehand.  I'm not clear if your confusion is down to how Mecanim itself works or AC's implementation of it.  I would definitely recommend you watch Unity's own tutorials
    on Mecanim parameters beforehand if you're new to that particular area.

    Sprites Unity Complex essentially works by manipulating the Mecanim parameters that you allow it to by writing them in the Player's Inspector.  You don't change those values (e.g. "Speed") yourself - AC will do that for you - what you need to do is add them to the transition conditions correctly.  But if you're not seeing those condition fields, it sounds like there's an issue more to do with Unity here.
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.