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
0
Question by Corvec · Oct 21, 2016 at 08:51 PM · animationscript.synchronizationagentresponse

Sync animation between multiple gameobjects on trigger

Hello all, ive been trying to find a solution or perhaps phrase what im looking for better. I have three game objects. when an event triggers I simply want to remove control from all players and carry out a series of movements/animations. For example a scripted combo where Player1 walks to Enemy(regardless of where they were when event triggered), punch enemy, the enemy now plays an animation/movement to the punch and is sent towards Player2, whom then plays another attack animation of some sort.

I can't seem to wrap my head around how to get the characters in place or how to play these individual animations and ensure they play out in sync with one another. Could someone at least help me to define a definition of what it is im trying to accomplish, perhaps I could research this better if I knew exactly what this was called.

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 smileteam · Oct 21, 2016 at 11:41 PM

Well, this kind of thing is very simple once you break it down into pieces. I'm not entirely sure what this is for, whether it's third person, first person, topdown, etc. so I'll try to give the best answer I can with little information.

So let's try and break it down anyway :

You have three characters. Each of them has a control script, whether that's player controlled or AI controlled.
They'll have an animation/animator component, something that contains the animations you want each of them to play.
You have "Points", yes? Where the characters will start and/or move towards.

Once you know what you have and what you need, we can start doing things.

You'll have to create an animation manager of some kind, it will have references (variables) to everything involved in the animation, that would be your characters, and movement points.

You should also create an Empty Gameobject root at the position where you want Player1 to be when it's "punching" Enemy, parented to Enemy.

Once the event is triggered the manager will disable the control scripts for the characters. Using this.

All characters should now be completely still and not move.

The next step is to move Player1 towards the previously created empty gameobject which should be parented to Enemy.

Whatever movement script you are using, you can use their movement function, or if you want something even better, create a Navmesh and Navmesh Agent for the player, so when you disable the control script, Player1 can move towards Enemy using the best path possible. While they're moving, just play the run/walk animation that you normally would play, or a leap, jump, or what have you.

Repeat for Player2 of course.

When the Characters get into position, just play the animations in turn (I don't know if you're using mecanim or the old animation system, but you should just be able to "waitforseconds" and trigger the next animation if you're looking for a quick and dirty method), and it should work out fine. Of course using the manager, re-enable all the control scripts so they can all move again.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

How can I sync animations between two avatars using the same animator controller? 0 Answers

How to make Animation and Physics work together? 2 Answers

How should I sync animations? 1 Answer

How can i use the Animator in script to find when animation clip finished playing and then stopping the animation ? 1 Answer

How do I stop my enemy character from spinning around in circles when I run past him? 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