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 Phenelo · Feb 14, 2014 at 06:34 AM · animationblending

Blending animations with mixing transform

A good day!

I'm having a trouble understanding how to manage animations with and without mixing transforms. So I have a Walking(full body), Tired(full body) and Breathing(target is chest) animation. What I want to achieve make the character stop walking then play the Tired animation with Breathing animation. The game will then wait for the Tired animation to reach it's end while Breathing is still playing before enabling the user to close a dialogbox. After closing the dialog box, blend the animation to Idle pose(full body animation; no mixing). How can I achieve that effect?

Here's my code so far:

 using UnityEngine;
 using System.Collections;
 
 public class PheneloCustomAnimation : MonoBehaviour {
     
     public Transform skeleton;
     public bool doingAnimation, canStopAnim;
     public float tempLayer;
     
     public IEnumerator Tired()
     {
         doingAnimation = true;
         Transform chest = skeleton.Find("hips/spine/chest");
         animation["Idle"].layer = 2;
         animation["Tired"].layer = 1;
         animation["Tired"].wrapMode = WrapMode.ClampForever;
         animation.Stop("Walk");
         animation["Idle"].AddMixingTransform(chest);
         animation.Play("Tired");
         while(doingAnimation)
         {
             //This thing is for giving time for the animation to reach its end
             //before the user can close the conversation dialog box
             Debug.Log(animation["Tired"].time);
             if(animation["Tired"].time >= animation["Tired"].length)
             {
                 canStopAnim = true;
             }
             yield return null;
         }
         //animation["Idle"].RemoveMixingTransform(chest);
         
         //animation["Idle"].layer = 0;
         //animation.RemoveClip(animation["Idle"].clip);
         //animation.Stop("Tired");
         //animation["Idle"].weight = 0.0f;
     }
 }

If I can figure this out it will be a great help in saving time coding the other behaviors. Would someone help me with this?

Much thanks in advance! :D

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 Phenelo · Feb 14, 2014 at 07:15 AM

Oh well. No need. I just didn't search that much though. Found an awesome answer here by Owen Reynolds. Pretty much explained about animation blending, layers and such.

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 Owen-Reynolds · Feb 14, 2014 at 07:16 PM 0
Share

I felt like I was the only one who liked the old, code and number-based, animation system. Seems like everyone just uses $$anonymous$$echanim now.

avatar image Phenelo · Feb 19, 2014 at 02:46 AM 0
Share

Had trouble in deciding what animation system to use before, but $$anonymous$$echanim didn't offer the "control" I need.

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

19 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

Related Questions

Deformation Maps Possible? 0 Answers

8-Way Animation Blending 2 Answers

How to use a locomotion blend tree (Walking) while also swinging a sword (With only upper body)? 1 Answer

Can I make animations snap to a frame? 1 Answer

Bug in Animator layer blending ? 4 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