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 fryedrycestyle · Jan 20, 2015 at 12:49 AM · animationtriggermecanim

Trigger Animation Instantly?

Hey!

I'm trying to trigger an animation on a button press, unfortunately it doesn't seem to respond within a decent amount of time - let alone the near instantaneous behavior I'm looking for. Basically player presses a button and I expect him to change from one animation state to the other. However it takes way too long (haven't actually timed it) for it to happen.

Here's the code (called from a method that is called in the Update() loop)

 if (_nextGem != null && Input.GetKeyDown(_laneButtons[NOTE_LANE.Bottom])) {
     _gemSmashers[(int)NOTE_LANE.Bottom].GetChild(0).GetComponent<GemSmasher>().onSmash();
             checkHit(NOTE_LANE.Bottom, (Time.time * 1000.0) - _start);
 } 
 
 .
 .
 .
 
 private void checkHit(NOTE_LANE lane, double time) {
 
     _characterAvatar.SetTrigger("RideToOlly");
 
 .
 .
 .

That's the only code that deals with animation currently.

Attached are some pictures of the animation controller.

alt text alt text

I'm not sure if this is an issue with my code, or with how I've handled the transition in the controller. I've tried adjusting the exit time in the transition, I've tried the different update modes, etc. Nothing seems to be having an effect. =S

Help would be appreciated!

animation_issue_two.png (32.9 kB)
animation_issue_three.png (23.3 kB)
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
15
Best Answer

Answer by fryedrycestyle · Jan 21, 2015 at 03:48 AM

Alright, answering my own question is probably poor form BUT, I managed to figured it out. I removed the exitTime condition from the transition and VIOLA it works!

Comment
Add comment · Show 2 · 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 Baste · Jan 21, 2015 at 07:36 AM 2
Share

Oh, I didn't spot that! Answering your own question when you found a better solution than any offered and then marking your own question as accepted is completely kosher, as that will show the question as resolved and move it out of the queue of non-resolved answers.

avatar image D3Duck · Sep 04, 2015 at 12:07 PM 1
Share

Well, you solved my problem so not poor form to me ;)

avatar image
2

Answer by Baste · Jan 20, 2015 at 09:07 AM

You need to make the transition time smaller. You see that blue outline in the inspector which shows the transition from Riding to Olly? That signifies the length of the blending between the two animations. If that's shorter, you'll get the change in animation much more quickly - though if it's too short, things might look bad as your model "snaps" to the new state

Just grab the arrows on it to make it narrower. If you need to sometimes jump to the animation, and sometimes let it blend naturally, set up two different transitions and give them different setups.

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 fryedrycestyle · Jan 20, 2015 at 06:33 PM 0
Share

Yeah, I had set that really small at one stage (like to the point where it was just a single blue line vertically), but there was/is still noticeable lag between the button press and the animation playing.

Hmm...

Basically I'm making a music game where the player is essentially skateboarding and the trick animations are played when the notes are hit (similar to Guitar Hero). At the moment we only have the two animations listed, but my artist will making more. I mention this b/c we want to have a system where hitting more notes in rapid succession mixes up the animations played to look like the player is perfor$$anonymous$$g a string of tricks. But, it seems there may be some lag which could screw things up if there is no other way to decrease the time between input and animation?

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

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

Mecanim Trigger Stays too long true 1 Answer

Totally new noob to mecanim and unity itself - Trigger animation? 0 Answers

Trigger Activated Multiple Times From One Click 2 Answers

Mecanim Trigger getting stuck in 'TRUE' state 9 Answers

Mecanim triggering an animation from object 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