so my workflow is stuck because I need to create 2 points from 1 point with a distance,
What’s the issue?
I need to sort the nodes in a way i could possibly go through
For example:
Instead of this {[1] = CurrentWaypoint, [2] = CurrentWaypoint}
I need something like: {[1] = CurrentWaypoint, [2] = PreviousWaypoint [3] = CurrentWaypoint [4] = NextWaypoint}
Did i find any solutions on the devforum
I couldnt find any solutions or anything related to my problem, mostly talking about how can they implement catmull-rom splines
Heres my code:
---------------------
----- VARIABLES -----
---------------------
local Nodes = {
[1] = Vector3.new(0,0,0);
[2] = Vector3.new(0,0,-20);
[3] = Vector3.new(20,0,-20);
}
local NodeDistanceFromOrigin = 5;
local NewNodes = {}
for NodeNumber = 1, #Nodes do
local Node = Instance.new("Part") -- created node visual
Node.Name = tostring(NodeNumber)
Node.Position = Nodes[NodeNumber]
Node.Anchored = true
Node.Color = Color3.new(1,0,0)
Node.CanCollide = false
Node.Transparency = .5
Node.Parent = workspace
local PreviousNodePosition = Nodes[NodeNumber-1]
local CurrentNodePosition = Nodes[NodeNumber]
local NextNodePosition = Nodes[NodeNumber+1]
if PreviousNodePosition then
local PreviousNode = Instance.new("Part") -- created node visual
PreviousNode.Name = tostring(NodeNumber-1)
PreviousNode.Anchored = true
PreviousNode.CanCollide = false
PreviousNode.Transparency = .5
PreviousNode.Parent = workspace
local Direction = (PreviousNodePosition - CurrentNodePosition).Unit
PreviousNode.Position = CurrentNodePosition + Direction*NodeDistanceFromOrigin
end
if NextNodePosition then
local NextNode = Instance.new("Part") -- created node visual
NextNode.Name = tostring(NodeNumber)
NextNode.Position = Nodes[NodeNumber+1]
NextNode.Anchored = true
NextNode.CanCollide = false
NextNode.Transparency = .5
NextNode.Parent = workspace
local Direction = (NextNodePosition - CurrentNodePosition).Unit
NextNode.Position = CurrentNodePosition + Direction*NodeDistanceFromOrigin
end
end