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 thatanimator · Jun 05, 2012 at 11:05 PM · animationtriggerstate

Animation state not playing out fully

http://www.youtube.com/watch?v=qDelGcKGtzE - video of what's going on, play in 480p+ to see the console prints

http://pastebin.com/GqLy3xQR - the javascript being used to trigger animations.

tl;dr version:

want to trigger two different kinds of lands based on how long you've been falling. the console tells me that the functions actually trigger, but the animation doesn't play. the animation works though, can trigger and play it in the editor.


     if (controller.isGrounded && Timer.Timer < 1.2 && state == 5){
          States.runjumpLandrun();
 }
     if (controller.isGrounded && Timer.Timer > 1.2 && state == 5){
          States.runjumpLandroll();
 }


 function runjumpLandroll(){
 
          animation.CrossFade("runjump_roll", 0.1, PlayMode.StopSameLayer);
          print("land_roll");
     
     if (Input.anyKey == false){
          animation.CrossFade("runjump_idle", 0.1, PlayMode.StopSameLayer);
          state = 1;
     }

}

function runjumpLandrun(){

     if (Input.GetKey("w")){
          animation.CrossFade("runjump_run", 0.1, PlayMode.StopSameLayer);
          print("land_run");
          state = 2;
     }
     else{
          animation.CrossFade("runjump_idle", 0.1, PlayMode.StopSameLayer);
          state = 1;
     }

}


(runjumpLandroll() doesn't start with a Input.GetKey atm, I've had that line in there before, didn't work at that time either. so I don't think that's the problem)



Hello! :) I've been trying to trigger a land_roll animation if my character falls for more than 1.2 seconds. Anything under 1.2 seconds should just result in a "normal" land.

I've got a timer that is enabled when you jump and which the controller.isGrounded function checks to see what land function to go to. I solved it with one function earlier. Just one land function that checked the timer rather than the controller.isGrounded checking and then sending us along to either function.

As you can see in the video, it works.

If the timer is less than 1.2 seconds (as it is when just jumping around on the "roof"), we're playing the normal land animations. The land-to-run and land-to-idle if you wish.

And when jumping off the "roof" the console prints out "land_roll" which is as you can see in the pastebin link, part of the function that should also trigger the roll animation.

But it doesn't.

I've tried different ways of solving this but with no success. I'm going to want to trigger yet another version of the land, if you fall for less than say half a second..hopefully the same timer workflow would work.

Anyone got a clue why the controller.isGrounded manages to trigger both "states" based on how many seconds the timer is at, but doesn't trigger the animation?

All animations work, I can trigger it separately using any other kind of input (space for example).

Thank you! :)

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 Berenger · Jun 06, 2012 at 03:51 PM 1
Share

Could you make it an answer and validate it please ?

avatar image thatanimator · Jun 06, 2012 at 03:54 PM 0
Share

tried to answer it before, guess it's waiting for a moderator to verify it :)

1 Reply

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

Answer by thatanimator · Jun 06, 2012 at 05:21 PM

http://pastebin.com/MqPQ3QD6

got it working after looking at the script for another day..

just copied the run part of the function that gets called if you're falling for less than 1.2 seconds,

function runjumpLandrun(){

if (Input.GetKey("w")){ animation.CrossFade("runjump_run", 0.1, PlayMode.StopSameLayer); print("land_run"); state = 2; } else{ animation.CrossFade("runjump_idle", 0.1, PlayMode.StopSameLayer); state = 1; }

}

and put the if (Input.GetKey("w")){ in the "longer than 1.2"-function and replaced the animation..

wonder what could have been wrong, code was basically the same.

oh well, fixed it! :)

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 Berenger · Jun 06, 2012 at 05:21 PM 1
Share

Indeed, moderation !

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Animator switches animation without trigger 0 Answers

Mechanim state triggers twice 1 Answer

Strange issue changing the animation state 0 Answers

trigger animation problems 2 Answers

Triggering a basic animation via Box Collider 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