How can i make the branches of mesh trees move in the wind?

Creating a map with realistic vegetation movement is quite difficult,and having the grass moving while the trees are completely still looks quite strange to me at least,it’s even more difficult to create a realistic windswept environment. I know that there are ways to make the foliage of a tree move,but how about the branches themselves? for half of the year,trees don’t have any foliage in temperate areas,and colorful spring maps become quite boring after a while,.

3 Likes

I don’t know about moving the branches…but I do know you can script your foliage to have leaves fall and seem like they are moving in the breeze. Moving branches is probably possible but I’ve never tried it

3 Likes

I think you’d be able to do it with animations. Of course you’d have to get a script to make it occur, but that’s my only guess.

2 Likes

I would suggest making the branches into separate models, animating them, then having that animation run constantly/or every few seconds.

3 Likes

If the tree is a model, you can put a value into the workspace. This might not be the most efficient way, but it works for me.

put this script into the value:

local child = game.Workspace:GetChildren()

script.Parent.Changed:Connect(function()
    if script.Parent.Value == true then
        while script.Parent.Value == true do
            for i = 1, desired number do
                for i, v in pairs(child) do
                    if v:IsA("Model") and v.Name == "Tree" then
                        local branch = v:GetChildren
                        for i, v in pairs(branch) do
                        if v.Name == "branch" and v:IsA("Mesh") then
                            v.Position = v.Position - Vector3.new(direction of the wind)  
                        end
                    end
                end
            end
            for i = 1, desired number do
                for i, v in pairs(child) do
                    if v:IsA("Model") and v.Name == "Tree" then
                        local branch = v:GetChildren
                        for i, v in pairs(branch) do
                        if v.Name == "branch" and v:IsA("Mesh") then
                            v.Position = v.Position + Vector3.new(direction of the wind)
                       end
                    end
                end
            end
        end
    end
end)

to make it look better, you can rotate the branches to make it look more connected, but I don’t know the math to do it.

5 Likes