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 save · May 17, 2011 at 09:58 PM · animationcrossfadeadditiveskinned-mesh

Shaking skinned mesh animations

I have a skinned mesh (arms and a steering wheel) with animations that twitch and shakes. The complexity of meshes around it seem to affect the amount of twitching (when approaching areas with dense objects the shakiness and twitching becomes worse). There's no physics affecting the skinned mesh but it is a child of a rigidbody (it doesn't matter if i turn animate physics on, the twitching is still there but gets less frequent).

Here's the code I use to additive go between states in the animation (left/right and so on):

var crossTime = 0.1;

private var rollLeft : AnimationState; private var rollRight : AnimationState; private var pitchUp : AnimationState; private var pitchDown : AnimationState; private var idleCockpit : AnimationState;

function Start () {

 rollLeft = animation["Roll_Left"];
 rollRight = animation["Roll_Right"];
 pitchUp = animation["Pitch_Up"];
 pitchDown = animation["Pitch_Down"];
 idleCockpit = animation["Idle_Cockpit"];

 animation["Roll_Left"].layer = 1;
 animation["Roll_Right"].layer = 1;
 animation["Pitch_Up"].layer = 2;
 animation["Pitch_Down"].layer = 2;
 animation["Idle_Cockpit"].layer = 0;

 rollLeft.blendMode = AnimationBlendMode.Additive;
 rollRight.blendMode = AnimationBlendMode.Additive;
 pitchUp.blendMode = AnimationBlendMode.Additive;
 pitchDown.blendMode = AnimationBlendMode.Additive;

 rollLeft.wrapMode = WrapMode.ClampForever;
 rollRight.wrapMode = WrapMode.ClampForever;
 pitchUp.wrapMode = WrapMode.ClampForever;
 pitchDown.wrapMode = WrapMode.ClampForever;

 rollLeft.enabled = true;
 rollRight.enabled = true;
 pitchUp.enabled = true;
 pitchDown.enabled = true;
 rollLeft.weight = 1;
 rollRight.weight = 1;
 pitchUp.weight = 0.3;
 pitchDown.weight = 0.6;
 idleCockpit.weight = 0.9;

 animation.Play("Idle_Cockpit");
 //animation["Idle_Cockpit"].speed = 0.5;

}

function Update () { var turn : float = Input.GetAxis("Turn"); var elevate : float = Input.GetAxis("Elevate");

 rollLeft.normalizedTime = turn;
 rollRight.normalizedTime = -turn;
 pitchUp.normalizedTime = -elevate;
 pitchDown.normalizedTime = elevate;


 if(Input.GetAxis("Turn")>0) {
     animation.CrossFade("Roll_Left", crossTime);
 }

 if(Input.GetAxis("Turn")<0) {
     animation.CrossFade("Roll_Right", crossTime);
 }

 if(Input.GetAxis("Elevate")<0) {
     animation.CrossFade("Pitch_Up", crossTime);
 }

 if(Input.GetAxis("Elevate")>0) {
     animation.CrossFade("Pitch_Down", crossTime);
 }


 if(!Input.GetAxis("Turn") && !Input.GetAxis("Elevate")){
     animation.CrossFade("Idle_Cockpit", crossTime);
 }

}

The animations work well and the blend between them as well, each of them are 5 frames from center to their corresponding clamp-maximum and the idle is just a small movement over 60 frames. They are imported from 3d Studio. What could possibly be wrong, am I missing something?

Comment
Add comment · Show 2
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 Joshua · May 18, 2011 at 03:10 AM 0
Share

Are you far away from the origin?

avatar image save · May 18, 2011 at 10:09 PM 0
Share

Looks like my comment response didn't survive the platform change here on UA. As of the origin in world space I start off at zero and the twitching is the same wherever, just that it gets worse when the terrain gets more dense with objects. I haven't worked with animations before so I have a feeling that I do something wrong - perhaps they're not intended to work like this with additive on different layers? Or does the code seem right to what I am trying to achieve? Could it otherwise be that the idle animation that it turns back to has to little movement?

1 Reply

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

Answer by save · May 19, 2011 at 10:32 AM

The solution turned out to be simple, I put the animation inside FixedUpdate() instead and turned Animate physics on. I guess the animation couldn't somehow sync correctly inside only the Update().

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 hannesdvl · Sep 06, 2012 at 03:18 PM 0
Share

Had the same issue and this fixed it, Thx! I still think it's a weird solution, do all animation updates happen in FixedUpdate?

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

2 People are following this question.

avatar image avatar image

Related Questions

how to crossfade a animation and then loop it 1 Answer

how to use animation layer with additive mode and root motion applied? 1 Answer

Can I make animations snap to a frame? 1 Answer

Play an animation just on some parts of the body 1 Answer

How to play the same animation multiple times? 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