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
5
Question by tehryan · Jan 07, 2015 at 06:11 AM · animatortransitions

Animator transition conditionals is OR possible, or only and?

I want one idle animation to be called if any of a number of conditions are met. Is this possible from within the transition conditions inspector panel?

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

5 Replies

· Add your reply
  • Sort: 
avatar image
9

Answer by asecretspot · Jan 07, 2015 at 07:16 AM

I may be misunderstanding what you are saying but... you can add multiple transitions between two animations and set them to be activated through different conditions. You may need to be more specific with your question.

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 tehryan · Jan 07, 2015 at 02:45 PM 0
Share

I have a 2d character that can face in 8 directions, with a different walk animation for each direction. I only have 2 idle animations, facing either forward or backward. I want it so that if I'm facing front-left, front or front-right and not moving, then to play the front facing idle animation. If I'm facing back-left, back or back-right, then to play the back facing idle animation. I can't figure out how to, or if it's possible to, use OR conditions in the transition panel.

avatar image asecretspot · Jan 07, 2015 at 09:09 PM 0
Share

If I understand you correctly it shouldn't be that difficult to get what you are trying to do. You just have to set your transitions properly. An OR condition could easily be simulated with an animator bool but I prefer not to code if there are ways around it.

You have to make it so your idle animations don't transition to each other but everything else should be able to transition to one other. I didn't add it to the quick picture but the back idle should be able to transition to the front animations as well I'm guessing but the picture would have gotten too messy. alt text

awesomepaintskills.png (9.7 kB)
avatar image
6

Answer by hersheys72 · Aug 19, 2016 at 06:06 AM

I had this same issue, it would be nice if they had the OR option!

The work around I had was simply to just add another transition which both linked to the same node.

EG Node 1 =Attack1, Node 2 = Attack2 Two parameters : AttackTrigger1, AttackTrigger2 from Attack1 node to Attack2 node create two seperate transitions first: AttackTrigger1 , second: AttackTrigger2 which will act the same as if from Node1 IF AttackTrigger1 OR AttackTrigger2 is triggered it will transition to Node 2

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 bdilloughery · Sep 29, 2017 at 09:49 PM 0
Share

But this would only work for a one-way transition like "Fire" or "Jump".

This wouldn't work for an ongoing animation that needs a transition in and a transition out like "Walking", as for example if you used two separate in-transitions and out-transitions from "Walking" to "Idle"

Bool of walking - true goes to walking, false leaves and goes to idle. Float of Speed - abs. value greater than 0.01 goes to walking, less goes to idle.

If one gets triggered (speed) and goes to walking, the bool for walking would still bring it back to idle and it would get all jumpy.

You could just put the two separate conditions in your script and write the OR statement there.

Example, in Update() you could have: if (condition1 or condition2) anim.SetBool("name",true) else //set it to false

This would mean you could use a single boolean as a condition even though it is really checking an OR between two conditions in your script.

avatar image
4

Answer by Orr10c · Oct 13, 2017 at 04:01 PM

Correct me if I'm wrong but I think you can simply add a number of transitions from one state to another and that should give you an OR effect. Hope this helped.

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 klaermans32 · Jul 17, 2020 at 10:08 AM 1
Share

this is AND

avatar image
3

Answer by rlmod17 · Mar 10, 2018 at 02:19 PM

Just use multiple transitions, if you add another one between 2 states, they act as or.

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 klaermans32 · Jul 17, 2020 at 10:08 AM 0
Share

they act as AND

avatar image
1

Answer by Dorthonion · Jul 05, 2017 at 12:31 PM

You can derive 'OR' from 'AND'

(A OR B) is the same as NOT ((NOT A) AND (NOT B))

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 Ecoludologist · Jul 05, 2017 at 06:54 PM 0
Share

This approach isn't possible within the animator, because there's no way to apply the outer NOT operator to (NOT A) AND (NOT B)

hersheys72's answer works fine

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

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

Related Questions

Animator transitions bug?,Animator transition bug? 3 Answers

problem with animations running then jumping 3 Answers

unwanted delay between animations 5 Answers

How to make animation transition to any other animation? 0 Answers

Animator won't let me add transitions 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