I have all the leafs pointing away from the point, but what I am trying to do is make it have an Intensity to each leaf and when set to 0 it goes back to its original position, and 1 as its strongest point towards. How would I ramp/strength this.
Here is the code i have so far:
local leaves = script.Parent.Leaves local leavesData = {} local windPosition = game.Workspace:WaitForChild("WindDirection") function grabData() for _, leaf in pairs(leaves:GetChildren()) do local leafWeld = leaves.Part.Weld if not leavesData[leaf] then leavesData[leaf] = { Weld = leafWeld; C0 = leafWeld.C0; } end end end function blend(orginal, position, intensity) -- instensity is from 0 - 1 --[[ 0 is orginal Anything between is the strength to position position is 1 ]] local fixedPosition fixedPosition = position return fixedPosition end grabData() while wait() do local Intensity = windPosition["Intensity"].Value local TopDirection = windPosition["Top"].Value for _, leaf in pairs(leaves:GetChildren()) do local data = leavesData[leaf] local windDir = (windPosition.Position - leaf.Position).unit local squashedLookVec = Vector3.new( windDir.X, TopDirection and (windDir.Y) or 0, windDir.Z ).unit * Intensity data.Weld.C0 = blend( Vector3.new(data.C0), CFrame.new(Vector3.new(data.C0), Vector3.new(data.Weld.C0) + squashedLookVec), Intensity ) end end
Here is picuture of what I'm trying to do: http://prntscr.com/orbtvj
Well, I figured it out! So I created a for loop to get each position between Original and position. this I used lerp
for n = 0, 1, 1/(4 - 1) do table.insert(list, a:Lerp(b, n)) end
after that, I edit the blend function and create the formal for the intensity and it works.
Gif Link below: https://gyazo.com/0f441015021f8b016cea4e7e83ba4270