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 /
avatar image
1
Question by Deathslice · Jan 13, 2018 at 05:00 PM · animation2dspriteanimator controllerblending

How to Sync the Running and Attack Animations for a 2D Sprite?

IF you look at the 2 and 4 row in the spritesheet that I provided, you will see that in the 2nd row the character is simply running while in the 4th row he is running and attacking at the same time. I wish to blend these 2 animations whenever the player decides to attack. I read about using avatar masks and creating separate layers to animate certain parts of the player's body for rigged 3D models but I'm not sure if I can take the same approach for 2D sprite. I would also like to extend so that player can also attack while idling. Any ideas how I can do it?

protomanspritesheet.png (90.6 kB)
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
1

Answer by MaxGuernseyIII · Jan 13, 2018 at 07:27 PM

You are facing the same problem a lot of people face when programming. You can either blend everything together and have to attend to every combination of every value of every variable, or your can break a problem down into smaller problems and solve each one independently, then find a way to link the solutions together.

In programming, it's a "no-brainer". The only people who think breaking things down into more cohesive solutions is harder are people who haven't yet become accustomed to doing it that way.

I can't say whether it's better for sprites, although I suspect it is.

Anyway, the two solutions for sprites are as follows:

  1. Mash the problem of running and attacking together by creating another row that is both running and attacking.

  2. Separate the arms from the body and animate the arm separate from the body.

The exact details of that would be up to you but, at an high level, I would expect you to create multiple game objects, set the anchors of the dependent game objects (e.g., the arm) to be at the point where it connects with its dependency (e.g., the shoulder), then move the image according to where that connection point is on the dependency object (e.g., as the torso moves, change the position of the arm accordingly).

There might be a better solution. I know that Unity had a pretty neat live session about 2D sprite stuff.

https://unity3d.com/learn/tutorials/topics/2d-game-creation/introduction-and-goals

I remember there being multi-layered sprite characters in that.

Comment
Add comment · Show 2 · 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
avatar image Deathslice · Jan 13, 2018 at 09:51 PM 0
Share

Thanks for your input. I was thinking of doing it this way but then I thought of some simpler approach and I would appreciate if you gave me some feedback. $$anonymous$$y new approach is this. If you look at the spritesheet, you can see that both the "running" animations and "running and attacking" animations have the same amount of frames and they are both one to one in terms of similarity. What I can do is if I'm on frame 5 of the running animation and I start attacking, then the running and attacking animation should start at frame 5 and it would be a smooth enough transition. Probably not a long term solution but is something I just thought up.

avatar image MaxGuernseyIII Deathslice · Jan 13, 2018 at 11:15 PM 0
Share

That should definitely work and I can see how it's probably an inexpensive change.

I'm not sure it's "simpler", though, because it leaves what the arm is doing conflated with what the other parts of the body are doing. If add a new thing for the arm to be doing, you have to attend to all the cases where they might be doing it. If you add a new thing the rest of the body might be doing, you have to make sure your weapon-arm cases are all attended to for the new activity type.

Still, as a transitional change toward something more sustainably-cohesive, it makes a lot of sense.

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

257 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 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 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 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 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 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 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 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 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 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

Beginner using the animation controller to get a sprite walking left and right..Need some help going from here 0 Answers

Multiple Animation Controllers 1 Answer

SpriteManager 2 1 Answer

Sprite animation 2 Answers

Animation System in 4.3 1 Answer


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