I am making a node creation system for a project I am working on, and I have tried many methods that have not succeeded fully (only works when nodes are along certain axis). What I would like to do is to make 2 points based on the position of one, i will explain further ahead:
From the distance to the green block and Mid, it only affects the Z axis, resulting in the start node only being affected on the Z axis, 4 studs behind the Mid, however, if the Y axis was to change:
Then so would the Y axis, but only based on where it is.
EXAMPLE
Lets say that the distance in between the green point and mid was 16, on the Z, and 16 on the Y also, 0 on the X, if I want the point to be 4 studs behind / Infront/ the difference, the Start would end up on (0, 12, 12), however, the outcome of the end part is based on the Node infront of it too:
Hi Sam, I remember you from YouTube. I’ve been working on improving on your engine, and I may have a solution for this. It isn’t too optimized but it should work for your old system that you had on YouTube. Here is the code. You can change the -2 and 2 to the number of studs you want the path offsetted by.
for Index, Part in pairs(workspace.items.nodes:GetChildren()) do
local node1 = workspace.items.nodes:FindFirstChild(Part.Name-1)
local node2 = Part
local node3 = workspace.items.nodes:FindFirstChild(Part.Name+1)
if node1 and node3 then
local Middle = Instance.new("Part", node2)
local End = Instance.new("Part", node2)
Middle.Name = "middle"
Middle.CanCollide = false
--Middle.Transparency = 1
Middle.Size = Vector3.new(0.5,0.5,0.5)
Middle.Anchored = true
Middle.CFrame = CFrame.lookAt(node2.Position, Vector3.new(node3.Position.X, node2.Position.Y, node3.Position.Z))
End.Name = "end"
End.CanCollide = false
--End.Transparency = 1
End.Size = Vector3.new(0.5,0.5,0.5)
End.Anchored = true
End.CFrame = Middle.CFrame * CFrame.new(0,0,-2)
node2.CFrame = node2.CFrame * CFrame.new(0,0,2)
end
end
This does the old node system that you had. I also have a question that you may be able to answer.
All of my turns are fine until there is a turn that is a different direction. The enemy partially does the turn then teleports into the correct position onto the path. I made sure that all of the code is good, but I just cannot seem to figure it out.