• Unity
  • Changing animation parameters in response to user input?

Related Discussions
...

I am trying to figure out how to achieve this exact effect: https://gfycat.com/thunderousimpishblacknorwegianelkhound

I believe that the trees are all rigged up in the same way, and have an animation that bends them from one extreme to the next. Then, based on the user's swipe or pan velocity, they sway to the right or left a certain degree.

Would anyone be able to provide some insight into roughly how this effect might be achieved with Spine? Is it possible to dynamically figure out how far and how much something can bend, and if so, how?

As a programmer I see the following solutions:

  • a) Create one extreme animation of e.g. 45 degrees sway and then use alpha < 1 (trackEntry.Alpha) to apply the animation with less intensity.
  • b) Use separate animations for different intensities (two might suffice, light-sway-right and heavy-sway-right) on separate tracks, start them all at the same time and then set the track alpha values according to the currently desired intensity. This would allow for different animations at different intensity. For this scenario it might not be necessary though.
  • c) Use constraints and then move the constraint target position / rotation (which defines the maximum angle) more or less to the side programmatically during gameplay, depending on the desired intensity.