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 Heratitan · Mar 25, 2013 at 05:18 PM · animationplayadditive

Why does an additive animation not play correctly when no other animation is playing?

In my project I am currently trying to setup a system where I have a set of animations for the upper body of my character and another set of animations for the lower body of my character that I play at separate times. The way I tried to do this was by playing by lower body animations on one layer and then playing my upper body animations, that I had changed to be additive, on a higher layer. This works very well except when there is no animation playing for the lower body and I try to play an animation for the upper body only. When I do this the animation seems to rotate and move a lot more than normal, and appear much different from how it plays normally.

Here is an example of code where I am having this problem:

 function Start (){
     animation["Attack"].blendMode = AnimationBlendMode.Additive;
 }
 function Update () {
     if(Input.GetKey(KeyCode.G)){
         animation.Play("Attack");
     }
 }

Any information on this would help a lot. Thanks.

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

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Owen-Reynolds · Mar 25, 2013 at 06:06 PM

The official way to have top half / bottom half animations is to cut-out bones using AddMixingTransform (or maybe you can check them off now, in the Inspector.) Then play the animations as regular "blended" (not Additive.)

But, what you have should work. As you note, Additive always needs something else playing under it. So, create a "frozen" animation. Just grab 1-2 frames at the start of idle, and have it loop. Then never stop the lower animation, instead, Play/CrossFade to frozen.

Comment
Add comment · Show 1 · 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 Heratitan · Mar 25, 2013 at 06:30 PM 0
Share

I was about to reply an say that I had already created a "frozen" animation to play under it, however your comment made me realize that I was accidentally stopping the "frozen" animation when I would play the attack animation. Thanks for the reply.

avatar image
0

Answer by Griffo · Mar 25, 2013 at 05:34 PM

Have you tried using CrossFade, just a thought, if your main animations are a walk or run then if the attack animations are only top half then it should CrossFade nicely, I find this a good way if you are doing your own animations.

 function Update () {
     if(Input.GetKey(KeyCode.G)){
        attack();
     }
 }
 
 function attack(){
     animation["Attack"].layer = 2;
     animation["Attack"].wrapMode = WrapMode.Once;
     animation.CrossFade("Attack");
 }
 function walk(){
     animation["Walk"].layer = 1;
     animation["Walk"].wrapMode = WrapMode.Loop;
     animation.CrossFade("Walk");
 }

Also this might be your problem -

http://docs.unity3d.com/Documentation/ScriptReference/AnimationState-weight.html

Comment
Add comment · Show 3 · 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 Heratitan · Mar 25, 2013 at 06:05 PM 0
Share

I have tried using CrossFade before, however, unless I make the blend$$anonymous$$ode of the attack animation Additive the walk animation is not played as the attack animation is being played on a higher layer and takes priority.

I had not thought about the weights of the animations being the problem, but I have tested this and the animations all seem to be weighted correctly.

avatar image Owen-Reynolds · Mar 25, 2013 at 06:12 PM 0
Share

The animation docs describe a specific top/bottom trick that lets you mix&match leg/arm animations. You might animate walk/run/idle/kneel only for legs, and shoot/punch/throw/idle only for arms; and be able to pick run+punch.

It looks like the OP is going from that.

avatar image Heratitan · Mar 25, 2013 at 06:18 PM 0
Share

I currently have the animations for the upper body only animate parts of the upper body, and the same for the lower body.

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

12 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

Related Questions

animation play in game over 1 Answer

Animation Stop and Stay 1 Answer

Play animation when in collider and button pressed 1 Answer

Character won't play animation 8 Answers

Animation Play Problem (Att: Video Example) 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