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 Ald · Nov 22, 2010 at 06:14 PM · animationsrunwalk

Play FULL walking animation

I have a model i created in maya with 3 different animations ... an Idle, a walk and a run cycle...I imported it into Unity and split the animations and attached the following script to it:

private var walkSpeed : float = 1.0; private var gravity = 100.0; private var moveDirection : Vector3 = Vector3.zero; private var charController : CharacterController;

function Start() { charController = GetComponent(CharacterController); animation.wrapMode = WrapMode.Loop; }

function Update () { if(charController.isGrounded == true) { if(Input.GetAxis("Vertical") > .1) { if(Input.GetButton("Run")) { animation.CrossFade("run"); walkSpeed = 4; } else { animation["walk"].speed = 1; animation.CrossFade("walk"); walkSpeed = 1; } } else if(Input.GetAxis("Vertical") < -.1) { animation["walk"].speed = -1; animation.CrossFade("walk"); walkSpeed = 1; } else { animation.CrossFade("idle"); }

     // Create an animation cycle for when the character is turning on the spot
     if(Input.GetAxis("Horizontal") &amp;&amp; !Input.GetAxis("Vertical"))
     {
         animation.CrossFade("walk");
     }


     transform.eulerAngles.y += Input.GetAxis("Horizontal");

     // Calculate the movement direction (forward motion)
     moveDirection = Vector3(0,0, Input.GetAxis("Vertical"));
     moveDirection = transform.TransformDirection(moveDirection);

 }

 moveDirection.y -= gravity * Time.deltaTime;
 charController.Move(moveDirection * (Time.deltaTime * walkSpeed));

}

The problem im having is when i play the game, the character plays the animations but not fully through...it will go through a few frames then jump right to the idle position...any ideas on how to make the full animation play?

Also, is there a way to speed up the animation? Because sometimes it looks like the animation plays very slow or takes a while to register... Thanks in advance!

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
0

Answer by Fredashay · Sep 28, 2015 at 06:15 AM

I'm a n00b and I had this problem perplexing me as well. I'm still going through the tutorial videos, and I purchased a character just to play around with who has a long complex idle state in which she looks around shifts her body around and fidgets. It's humorous, but if I start walking, the walking animation isn't triggered by the state transition arrow. The character moves around the plane just fine, but she does so doing her idle animation.

Searching for answers in Google and in Unity Answers brought me to your question. Alas, it had no answers at the time, so I carried on.

I discovered there's a checkbox called HAS EXIT TIME (you have to be in the Animator, then click on each of the transition arrows, and you'll see the checkbox in the Inspector for this variable). If this is checked, then the animation can only be interrupted during its "exit time." So if you uncheck HAS EXIT TIME, the animation can be interrupted any time during the animation.

There's also a variable called LOOP TIME (you have to be in the Scene, then click on the animation in the Assets, and you'll see the checkbox in the Inspector for the animation). This variable must be checked for the animation to be repeated. This also perplexed me for a time. The character would do the walking animation for one loop, then freeze, even as I continued walking. When I checked LOOP TIME, the walking animation repeated as long as the character walked.

Now that I figured it out on my own, I thought to come back and answer your question. I see your question is several years old and still has no answers, so I hope my answer is still helpful for you.

So in summary, you want to uncheck HAS EXIT TIME in each transition, and you want to check LOOP TIME in each animation. This will let your animations repeat over and over as long as that state is true. And will let you interrupt an animation in the middle of that animation to change state to a different animation, which will repeat over and over while that state is true.

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
avatar image
0

Answer by itsharshdeep · Sep 28, 2015 at 05:20 AM

Single click the animation in animator it will Show a parameter of Speed in Inspector. There you can set the speed of the animation.

alt text

*Tip:- You can also give the speed in negative to invert the animation ( to reverse/backward the animation)

For complete the animation pls check the following links hope they will help

http://docs.unity3d.com/Manual/class-Transition.html http://answers.unity3d.com/questions/787976/what-can-interrupt-a-non-atomic-transition-in-the.html


speed-parameter.png (88.3 kB)
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

1 Person is following this question.

avatar image

Related Questions

where can i get ready made fps animations? 2 Answers

walk crossfade run animation based on joystick position need help please 0 Answers

Character controller with key click to move forward 0 Answers

[SOLVED] Walk, Run and Sprint with single key 1 Answer

walk to run animation 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