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 MrMika · Aug 29, 2014 at 12:57 PM · animation2dspriteanimator

Object not moving after changing animator parameter

Hello!

I'm having problems with animations and animators in my 2d project, because i can't move an object after changing animation, by changing a parameter in the animator.

This is what i want to do:

  1. Animate the object to go up and down in the air

  2. Receive input

  3. Change the current animation (sprite going up and down) to another animation that only changes the sprite of that object and switch physics on on that object

This is how trying to do it:

  1. Create two animations (one that makes the object go up and down, that changes the position property of the object, and another one that only changes the sprite of the object, that only changes the sprite property)

  2. Make the animation that goes up and down the default animation

  3. Make a transition from the default animation to the animation, that only changes the sprite, that is triggered once a boolean parameter on the animator is set to true

  4. Set the paremeter to true to trigger the second animation

  5. Turn off "Is Kinemetic" (so that it can be affected by gravity and other forces)

This is what's happening:

  1. The object goes up and down using the first animation

  2. Input is received

  3. The second animation starts playing (changing the sprite of the object) but the object does not move (it stays in the air and it is not affected by gravity or other forces, even though the "Is Kinemetic" is turned off)

This only happens when the second animation changes the position property of the object, so i would like to know why this is happening and/or how i can fix this. Thank you for reading this.

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 MrMika · Aug 29, 2014 at 04:33 PM 0
Share

I did some more tests and it is the second animation that is locking the object at (0, 0, 0) but that doesn't happen if i only use that animation and no parameters.

avatar image MrMika · Aug 29, 2014 at 06:15 PM 0
Share

I made some more tests and now i found out that the problem is that when going from one animation to the other, the second animation will lock the values of the properties that are in the first one, but not on the second one. This means that, since the first animation changes the position property but the second one doesn't, the position property on the second animation gets locked at (0, 0, 0) and i can't change it in the inspector (i also tested this with scale and got the same results). I also found this and now i don't know how to do it. Is there a way to "disable" a curve in the animation so that it gets controlled by code/physics again? If there is not, isn't that something that should be implemented?

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by curiouspers · Mar 06, 2015 at 01:24 PM

I know this tread is old, but i cant find any information for Unity 4.x how to use this, but i figured out, that you can use animation layers for 2d objects as well, and that do the trick.

So how i do it: Create a new layer for second animation, set weight to 1, blending override. Move animation state that only change the sprite to new layer, make transition from Any state to this animation. Set transition condition to use trigger (or boolean) animation parameter. You might also need another animation state for idle (with default sprite).

Hope it might help someone.

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

23 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

Related Questions

2D Animation does not start 1 Answer

2D Character getting a weapon. Changing it's sprites/animations 0 Answers

Animator warning in editor, animation is preventing script from working 1 Answer

How to show two 2D animations at the same time? 1 Answer

Sprite becomes invisible when set on animator 0 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