0
votes

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!

1
For the which part do you want help ? animator part or touch ?ATHellboy
Touch part. the animation are ok. I need help with the itearction. thanks!guillebaron

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.

  1. In update check whether someone is touching the screen.
  2. Then check if the phase of the touch is "began".
  3. If someone is touching the screen, use the Animator.SetBool() function to set the boolean for the animator to true.
  4. 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.