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:
- Animate the object to go up and down in the air
- Receive input
- 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:
- 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)
- Make the animation that goes up and down the default animation
- 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
- Set the paremeter to true to trigger the second animation
- Turn off “Is Kinemetic” (so that it can be affected by gravity and other forces)
This is what’s happening:
- The object goes up and down using the first animation
- Input is received
- 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.