Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by sporcehorrier · Aug 27, 2015 at 05:26 AM · 2dmovementanimatorshmup

Issues w/ 2D shmup ship "lean" animations on diagonals

I'm trying to set up a ship in a vertical-scroll shooter. It's 3 sprites: straight(idle), lean left, lean right, and using PlayMaker to call Animator states* (bools) of those on Horizontal axis input (just "Get Axis" actions, not "key up/key down").

Works fine in the regular 4 directions, but I want the "lean" sprites to be the "dominant" ones when traveling diagonally. And right now they're not: for example, I will press and hold left, watch the animator state activate "left" for a second, then push the down arrow at the same time and watch that take over and kill "left."

Somehow this succeeds in one direction -- When going up-left (or left-up!), the "left" state properly plays and stays! But not with the others. I thought maybe it's because up and left are the positive and negative of Vertical and Horizontal except diagonal movement/velocity works how I want it.

I've tried this with Animator state transitions, without transitions, with one or two transitions, and I get nothing but the same result. This looks so basic/natural in actual shmups, so I wonder what I'm missing, and can't tell if the culprit is Playmaker or Mecanim, or something deeper in Unity.

*I'm using the 2D and Animator PM extensions.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by sporcehorrier · Sep 18, 2015 at 06:06 AM

Solved! First I had to (re)watch this video on animating sprites, which by the last third of it, teaches you how to create and set Animator floats with Playmaker to call the animations you want.

Unlike the video, I stopped short of creating multiple Animator states/transitions, instead creating a Blend Tree on a single state that had fields for Left/Right/Idle, or -0.1/0.1/0 thresholds on the x-axis. This better handles when to call the animations, and by not involving the y-axis here in any way, it doesn't "know" when the ship moves up or down and keeps the 'left' or 'right' animation when activated, then snaps back to idle when neither happen.

Basically, I learned that Animator transitions weren't smart or efficient enough for this, and that math is the answer (as always?!).

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

27 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Player doesn't face in direction of its last movement direction 0 Answers

Issue: deactivated animated sprites reappear and go crazy on animation state transition 0 Answers

Animator prevents rigidbody movement 1 Answer

Move 2D object forward 1 Answer

Adding small acceleration to 2d top down movement game? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges