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 Sayuka · Jun 28, 2014 at 03:08 PM · c#animationwrapmode

Animation not playing completely

I am having the problem that none of my animations (done in blender) plays all the way though. for most, that's not even an issue, though my attack animation looks just odd without playing completely.

My current script for choosing animations (inside my AnimationChooser.cs file) looks like this:

     void Update () 
     {
         Player pstats = Player.GetComponent<Player>();
 
         float running = Input.GetAxis ("Vertical");
         float jumping = Input.GetAxis ("Jump");
         float dashing = Input.GetAxis ("Dash");
         float hitting = 0.0f; //for being hit
 
         if (pstats.Hitanim) 
         {
             hitting = 1.0f;    
         }
 
         if (!pstats.Hitanim) 
         {
             hitting = 0.0f;    
         }
 
         if (Input.GetKeyDown ("a") && pstats.SlashUsable) 
         {
             pstats.SlashLeft(); //basicly just starts the attack-script
         }
 
         if (Input.GetKeyDown ("d") && pstats.SlashUsable) 
         {
             pstats.SlashRight(); //attack-script again
         }
 
         if (!pstats.SlashUsable) 
         {
             dashing = 0.0f;
         }
 
         anim.SetFloat ("Speed", running*running);
         anim.SetFloat ("Jumping", jumping*jumping);
         anim.SetFloat ("Dashing", dashing*dashing);
         anim.SetFloat ("Hitting", hitting*hitting);
     }

The "Dash" is the one I need to play all the way through. On pressing the proper keys, it only plays around half-way. if I hold the key down, it plays half way once and then fully once, though that's not really the intended way.

I heared of having to start at frame 1 in blender (currently I go from frame 0 to 24), though when I tried to reimport my animation it went completely crazy (completely deformed the character), even though I only moved keyframes around.

I also heared about wrap-modes, but in all honesty, I am new to Unity and don't really know how and where I have to implement those.

Is there any way I can edit the code to have the animation play once, all the way through on one button press? (the difference between SlashLeft and SlashRight is just the characters rotation, the animation is the same)

Any help is highly appreciated.

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
2

Answer by meat5000 · Jun 28, 2014 at 10:57 AM

In Animator Window, click the transition from the attack animation and change Exit Time from 0.85 to 1.0

Comment
Add comment · Show 5 · 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 Sayuka · Jun 28, 2014 at 11:40 AM 0
Share

that worked, thanks! Though I noticed another odd thing. Whenever I use the attack, the character is lifted in the air slightly, like as if the animation was making him float above the ground for the first half of the attack. I have no idea why.

avatar image meat5000 ♦ · Jun 28, 2014 at 03:11 PM 0
Share

In Import settings for the model, In Animation tab, bake Y Position.

avatar image Sayuka · Jun 29, 2014 at 09:01 AM 0
Share

Well, I went to the Import settings - Animaion tab, and saw that "Root transform position (Y)" and checked "Bake into position", that didn't do anything. I tried both settings I have in the drop down menu and tried an off-set also, didn't change a thing.

avatar image meat5000 ♦ · Jun 30, 2014 at 09:46 PM 0
Share

Did you make sure to select the correct animation from the list before doing this? :)

avatar image Sayuka · Jul 01, 2014 at 12:26 PM 0
Share

of course, I made sure to do it on my attack-animation. It's the top of the list even. And yes, I also clicked "Apply" ^^

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Programmatically created AnimationClip will not loop 2 Answers

Clamping an animation does not work. Help! 0 Answers

Distribute terrain in zones 3 Answers

How to avoid animation from resetting after its completion? 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