I already have the starting Logic, but currently after that it just shoots straight up in the sky [right rocket]. The left Rocket only has the start logic and is slower.
Because the left on eshould follow a path I already created
for i = 0, numPoints do
local t = i / numPoints
local point = Bezier(t, modifiedStartPos, B, Target) -- a math function defined above
table.insert(curvePoints, point)
--Visualisation or maybe smt I need idk
local p = Instance.new("Attachment")
p.Name = "Attachment"..tostring(i)
p.Position = point
p.Parent = workspace
p.Visible = true
end
Now I want to apply the VectorForce or LinearVelocity, so that it flys to the next point.
I also added a AlignOrientation.
But at the moment I am not able to align the rocket right and get it so it wont go to high etc.
I also calculated the NukeMass, according to the workspace.Gravity. Thats the minimum Y Force we need to apply so it can fly.
Does anyone know how to get this alignOrientation and Vector Force to apply correctly?
I cant get the AlignmentOrientation to look at the correct angle.
Thanks for your help. If you need more informations just ask me.
Wouldn’t it be easier if you put the nodes into a folder then iterate on it?
local folder = game.Workspace.Folder -- this is the folder with parts that we will use as our nodes
for i, node in pairs(folder:GetChildren()) do
local p = Instance.new("Attachment", workspace)
p.Name = "Attachment"..tostring(i)
p.Position = node.Position
p.Visible = true
end
-- continue with your original script
Also can i see your entire script with the AlignOrientation and VectorForce logic? That would really help.
local runService = game:GetService("RunService")
local points = --get points here
local i = 1
local a = 0
local startingPoint = points[i]
local goalPoint = points[i + 1]
local connection
connection = runService.Heartbeat:Connect(function(dt)
a += dt
if i > #points then
connection:Disconnect()
return
end
if a => 1 then
a = 0
index += 1
startingPoint = points[i]
goalPoint = points[i+1]
end
local targetCFrame = CFrame.new(startingPoint:lerp(goalPoint, a), goalPoint)
end)