What's the best way to get a tree, to bend, and move it's leaves like an actual tree? Animation? But how would you add that to a tree it sounds hard.
Trees move because of the wind around them.
A basic approximation for wind would be assuming that there is a constant force in a constant direction in the entire space about the ground acting on all objects.
We can model the tree as a set of squishy pieces which have a restoring force to bring them back to their normal (upright, for the trunk) position. Because of this restoring force, if the wind's force remains constant, after a long time the tree's pieces would reach a particular position and rest. So, we can approximate the squishiness of the tree by moving directly to that equilibrium position for the current wind.
This means we do not have to worry about the current state and the force on the tree (though we could do that to probably achieve a more realistic response to simpler winds)
Observations: A trunk moves less in the breeze than a branch. Branches, which move more, are both smaller and further away from the base of the tree. Either mass or distance from tree base could be used for the amount moved. Let's use distance from tree base (probably needs some adjustment to be weak for the first half or so of the tree's height and then much strong)
Here's a simple thing we could use:
function equilibrium(resting, treebase, wind) local res = math.exp(-(treebase - resting).p / 5.0) - 0.5; return resting + wind * res; end
Finally, at any moment we want to update the tree, we simply have to "rebuild" it, but with all points that we used before mapped through the equilibrium
function.