1-I am making a small app in 3d mode for android using blender and unity. 2- I made rigged character with an iddle animation and a happy animation in blender. 3 -I imported it correctly into unity. i put the bool parameters in the unity animator and all works fine, even tested on the phone. Problem: I cant find a good tutorial to create the interaction(code) between the animations and the touch screen event. hope you can understand me. Thanks in advance!
0
votes
1 Answers
0
votes
If I understand correctly you want to transition from Idle to Happy Animation on the touch of a button and you said the animation is not a problem.
Since you have not provided any code I can tell you the algorithm.
- In update check whether someone is touching the screen.
- Then check if the phase of the touch is "began".
- If someone is touching the screen, use the Animator.SetBool() function to set the boolean for the animator to true.
- Setting it to true will transition it you have set the transition condition to the above mentioned boolean.
Use the Unity Scripting Reference to understand the touch functions better. Unity Touch Scripting Reference
And I would recommend watching this Animator Controller Tutorial to learn about it.