So I am creating an ability for my game and so far it looks good, the rocks form and animate well as you can see below.
https://gyazo.com/5cef1f58b36a4d569bc8efa24318e37c
The current code for this is here:
local faultLineRock = abilitiesModel.FaultLineRock
local rootPartCFrame = humanoidRootPart.CFrame
local rocks = {}
for i = 1, 4 do
local copy = faultLineRock:Clone()
copy.CFrame = rootPartCFrame * CFrame.new(0, -10, -6 * i)
copy.Parent = workspace
table.insert(rocks, copy)
local properties = {
CFrame = copy.CFrame * CFrame.new(0, 8, 0)
}
TweenService:Create(
copy,
TweenInfo.new(0.4, Enum.EasingStyle.Back, Enum.EasingDirection.Out, 0, false, 0),
properties):Play()
task.wait(0.1)
end
task.wait(1)
for index, rock in pairs(rocks) do
local properties = {
CFrame = rock.CFrame * CFrame.new(0, -10, 0)
}
TweenService:Create(
rock,
TweenInfo.new(0.4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0),
properties):Play()
task.wait(0.1)
rock:Destroy()
end
So I am currently trying to figure out how to angle each rock however when I try changing this line:
copy.CFrame = rootPartCFrame * CFrame.new(0, -10, -6 * i)
To this:
copy.CFrame = rootPartCFrame * CFrame.new(0, -10, -6 * i) * CFrame.Angles(math.rad(45), 0, math.rad(45))
These are the results:
https://gyazo.com/b8631469eefc61a84d6ea20e83ea6ffe
So how would I go about angling the rocks while still maintaining how they are positioned and animated like in the first result?