Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 fschaar · Jul 05, 2013 at 06:37 AM · animationanimation layers

mixing animations

I want to mix to different animations together but I don't get it to work. My Blender made character shall change a little during a spezial game state. So I added a keyframe, that only scales the head bone a little so the head of the character appears bigger. Then I still want to use all other animations with the character (like walking) just with the bigger head. so i put this (BigHead) Animation to a higher Layer (10) and enabled it. But I didn't see anything change. Then I tried the AddMixingTransform function which didn't work either. Can anyone tell me how to achive that? can it be a problem, that i used LocRotScale Keys for all Bones on all the other animations?

Here are some Code Snipsets:

 void Start () {
         boxBehaviour = gameObject.GetComponent<BoxBehaviour> ();
         rowdyBoxHead = animation["rowdy_box_layer"];
         //rowdyBoxHead.play();
         animation["rowdy_box_layer"].wrapMode = WrapMode.ClampForever;
         //rowdyBoxHead.layer = 10;
         //rowdyBoxHead.wrapMode = WrapMode.ClampForever;
         rowdyBoxHeadTransform = transform.Find("Armature/Root/Root_001/Root_002");
         StartCoroutine(ActivateRowdyMode());
     }
     
     
     
     IEnumerator ActivateRowdyMode(){
         yield return new WaitForSeconds(60);        
         //rowdyBoxHead.enabled = true;
         //rowdyBoxHead.weight = 1.0f;
         animation["rowdy_box_layer"].AddMixingTransform(rowdyBoxHeadTransform);
 //        animation.CrossFade("rowdy_box_layer");
     
     }
Comment
Add comment · Show 7
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 Benproductions1 · Jul 05, 2013 at 08:13 AM 0
Share
  1. Usually you add mixing transforms at the start

  2. If you want animations to player, you have to un-comment the Play call

  3. That is also not how you play animations

  4. Look at the documentation

avatar image fschaar · Jul 05, 2013 at 08:41 AM 0
Share
  1. The mixing Transform shall Start after 60 seconds?

  2. I know, there where two different ways I tried in the documentation and I tried both here - so some are commented out. What I postet ist the last try of course it doesn't work. It shows just what I tried

  3. What do you mean? I got a lot of animations to play. But the documentation said, if I layer animation, I do not use .Play() I just enable them - did not work, or at least I didn't see anything second Way was to use animation $$anonymous$$ixing - therefore I used .Play () - now commented out - didn't work either. So I tried to combine things and ended up with the mess you see currently.

  4. I did und I did it exactly as it was written there (even so you don't see it anymore)

avatar image Benproductions1 · Jul 05, 2013 at 08:59 AM 0
Share

As paraphraised from a person whose name I've forgotten:
"Sometimes you just have to select the entire contents of a function and press delete"
I know how horrible that sounds, but once something turns into a mess, its easier to start from a clean slate, than trying to clean it up.

The way you usually do it (with legacy animations) is you set the layer (and the mixing transform) in Start (as well as any other animation settings), then you use animation.Play(name:String) to play the animation.
That's how I would do it, and that's how I've done it in the past :)

avatar image fschaar · Jul 05, 2013 at 10:23 AM 0
Share

I have the following now:

 void Start () {
         
         animation["rowdy_box_layer"].wrap$$anonymous$$ode = Wrap$$anonymous$$ode.ClampForever;
         rowdyBoxHeadTransform = transform.Find("Armature/Root/Root_001/Root_002");
         animation["rowdy_box_layer"].Add$$anonymous$$ixingTransform(rowdyBoxHeadTransform);
         StartCoroutine(ActivateRowdy$$anonymous$$ode());
     }
     
     
     IEnumerator ActivateRowdy$$anonymous$$ode(){
         yield return new WaitForSeconds(5);        
         animation.CrossFade("rowdy_box_layer");
 
         
     }

The Head scales up, but the underlying idle animation seems to be suppressed. After a while, the walk animation starts and after that the head rescales back to its normal size. I do not see, that both animations work together. But I belive that $$anonymous$$ixing is stopped the $$anonymous$$oment I fade another animation in?

avatar image Benproductions1 · Jul 06, 2013 at 12:46 AM 0
Share

Blending is a completely separate process to the animation itself. It only has an effect on how the animation gets applied.
As stated by the documentation, CrossFade Fades out all other animations, and fades that one in. That's why it seems it "suppresses" the other animations. I suggest a different layer

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
2

Answer by Benproductions1 · Jul 09, 2013 at 12:22 AM

Hello there,

Using animations from a long dead project (and a couple minutes of try/fail), I created a script that did exactly what you want to achieve.
The names are a bit different, but you can get the general idea ;)
It's also written in js, but you should have no problem following the logic

 var hip:Transform;
 
 function Start() {
     
     animation["Run"].wrapMode = WrapMode.Loop;
     animation["Run"].layer = 1;
     animation.Play("Run");
     
     animation["StandingAimDown"].wrapMode = WrapMode.ClampForever;
     animation["StandingAimDown"].layer = 1000; //above anything else
     animation["StandingAimDown"].AddMixingTransform(hip);
     
     yield WaitForSeconds(3);
     
     animation.Play("StandingAimDown");
 }

This is tested and working.

Hope it helps,
Benproductions1

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

17 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

Related Questions

Animator Override Controller Layer Issue 1 Answer

Correct way to use mecanim and AddMixingTransform? 1 Answer

Issue with animation 1 Answer

Can the animation editor create local rotational data? 3 Answers

Adding animation clips via script 2 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