So I’ve been making and rigging a tree to be used within my game and am currently trying to animate the tree’s leaves to move in realtime similar to a wind effect, but can’t seem to figure out how to do it.
The tree has 1 bone for the log, 8 bones for the leaves vertically and 4 bones for each horizontal level of the tree:
I prefer realtime animation over a preset animation because I want the trees to move seemingly at random (with the wind affecting which direction and how much) and using a preset animation would look too deliberate.
All and any ideas and solutions are highly appreciated!
It’s usually a trivial operation in the vertex shader, not a rigged thing… Generally you’d use a vertex colour attribute to store properties like frequency and magnitude in each vert (they’re not used for colouring).
Then the vertex shader reads these vertex attributes and does the calculation for wind regardless, but controlled by the data you embedded in the verts.
But if you are hell bent on animating it via bones then the way to do this would be to grab each bone in a script (they become simple transforms in Unity - see for yourself in the hierarchy) and move them around, perhaps using Unity - Scripting API: Mathf.PerlinNoise for flavour.