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 MonkeyZero · Oct 27, 2019 at 02:59 AM · animationcontrollersynccharacterssynchronize

Can I Animating a pair (or more) of Characters with one animation controller?

Okay, as part of my Game story, I want the player to attend a Royal Ball at the palace and to fit in he will need to choose a dance partner and try to fit in under cover.

What I would like is to create two clips. One of the player leading, and one with his dance partner being led as they dance.

Ideally, I would like the player and his dance partner be handled by one controller where the Player is the primary and the partner being linked into it and made to follow his lead all with one Animation controller.

But for the life of me I can not figure how how I would go about that and keep both animations in perfect sync so that at times, I can throw a QuickTime even and if they botch the QTE then they flub that part of the dace but pick up soon after and have another twirl on the floor.

If not from a single Animation controller how would I go about getting two or more characters to be animated with different clip that are all designed to work together frame for frame to make a complete animation with several character at once interacting with each other?

Thanks in advance for any advice or help in this...

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 Pinkuboxu · Oct 27, 2019 at 04:43 PM

Are you making a Pirate's! type game :D? Well, the Animation Controller can be the same for two characters but the Avatar may need to be different if there are different bones. Best to keep all of the bones in the skeleton universal to one Avatar, since I doubt you are going to have dancing with quadropeds, so that's probably easier. Hopefully you are familiar with the Animation Controller's state machine node editor. They used to call it Mechanim but I rarely hear that name.


Have to have two State nodes in the state machine that come off the Animators "Entry" Transition node. You'll need a parameter inside Mechanim like a bool. Maybe call it "isPartner". In a script you need to have a reference to the lead and partner character's individual Animation Controller components,

 public class DanceController : MonoBehavoir
 {
     // you can simply drag the dancer objects onto these public variables in the script component, from the hierarchy to reference to their animators and to access the functions. If you prefer, make sure you do so with GetComponent<Animator>() in the Start() event with some other means of gaining access to components outside of this script components scope.
 
     public animLead;
     public animPartner; 

     void Start()
     {
     // reference any external components here if necessary
     }

     void Update()
     {
     // trigger all transitions here using whatever method your specific game play calls for. Remember to trigger one animation parameter per object to sync right after the other so they sync on the same frame.
     }
 }

so you can send a { animPartner.SetBool("isPartner", true); } command to the partner and false for the lead, IF they ever change roles. Otherwise you can just set them manually in the Animation State Machines parameter editor. You'll have to have a Transition to the Partner State node from Entry so that it understands the animation it should be using initially for the partner, and so that you can branch the separate animations from each other.


Each dance pairing needs a node. I'd put the Partner Node below the Lead node, then have the partners dance move nodes below the partner, and the lead nodes above the lead characters node. Then you link transistions from each partners nodes, giving them conditions based on Animation Parameters, and set them in your DanceController with Animator.SetBool or SetInt or whatever type of parameter you need to control the flow of the dance.


Syncing them should work fine as long as each dance move was made with the same amount of frames as the corresponding ones. Just make sure you trigger both animations, with the SetBool command in the same frame, or more easily put, one line after the other in your code with nothing in between. This ensures that each transition takes place at the same time. Don't change one transition state timing unless you also change the corresponding one to match because the State Machine handles timing for you and fiddling with the Transition speeds will make two animations that are synced in your Animation editor or 3d modeling program. Likewise the animation speed itself shouldn't be changed unless the corresponding dance animation speed is changed to match up with it.


I'm trying to also think how to do this with Layers, but layers are more for blending and syncing animations in a single character. You could technically switch from the player controller, to a set up where your dancers are one mesh using the same animation controller component. I mention that below but it doesn't really seem like a great solution, but a possibility.


That is the best I can describe the process. There is also simply combining all the animations together for both characters in one big skeleton, so that each dance is just one animation for two combined objects, but you'd need to have a means of swapping out geometry if you had multiple partners or a the main character had different meshes, like a suit or dress for the dance, and that all doesn't really leave much room for flexibility. There are also tools on the asset store that allow for real-time animation of skeleton based characters inside of Unity that would probably help a lot, but the arey not free.

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

372 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image 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

Animation Trigger (Rpg Kit) 1 Answer

Ethan 3rd person character 1 Answer

My object spinning itself (HELP) 0 Answers

Model is distorting when animation is running 0 Answers

help to connect two objects together 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