my goal is to make very basic generating terrain here is my code
Note: The setParams() Function just sets a Size, Anchored boolean, And a Color (im very lazy)
for i = 1,100 do
local ray = Ray.new(Part.Position,Part.CFrame.RightVector * 50)
if not workspace:FindPartOnRay(ray,Table[i]) then
local Par = Instance.new("Part",workspace)
table.insert(Table,Par)
Par.Name = "Fart1"
setParams(Par)
Par.CFrame = Part.CFrame * CFrame.new(0,0,32)
end
local ray = Ray.new(Part.Position,Part.CFrame.RightVector * 50)
if not workspace:FindPartOnRay(ray,Table[i]) then
local Par = Instance.new("Part",workspace)
table.insert(Table,Par)
Par.Name = "Fart"
setParams(Par)
Par.CFrame = Part.CFrame * CFrame.new(0,0,32)
end
end
This works perfectly fine with lookVector and UpVector but for some reason whenever i use RightVector i just doesnt execute the code inside the if???
And this is what i was able to create until i ran into the issue with when i try to use rightVector it simply does not execute the code shown under the if statement
Basically what im trying to do is for each one of these parts:
i am sending a ray left and right and checking for a part if there is not one it creates a part in a infinite loops in what my end goal will be procedurally generated terrain
and to what you said there is no errors no nothing it simply just does nothing
Let me reexplain because it doesnt seem like you understand
local ray = Ray.new(Table[i].Position,Table[i].CFrame.RightVector * 50)
if not workspace:FindPartOnRay(ray,Table[i]) then
print("d")
end
This is thats being attempted to read the parts around it but nothing under the if not workspace:FindPartOnRay(ray,Table[i]) then runs regardless of anything
It looks like you’re raycasting to the right twice. You explained you wanted to do left and right if I interpreted correctly. Try setting the second portion to Part.CFrame.RightVector * -50 instead of Part.CFrame.RightVector * 50
for i = 1,100 do
local ray = Ray.new(Part.Position,Part.CFrame.RightVector * 50)
if not workspace:FindPartOnRay(ray,Table[i]) then
local Par = Instance.new("Part",workspace)
local Par2 = Instance.new("Part",workspace)
table.insert(Table,Par)
table.insert(Table,Par2)
Par.Name = "Fart1"
Par2.Name = "Fart"
setParams(Par)
setParams(Par2)
Par.CFrame = Part.CFrame * CFrame.new(0,0,i*32)
Par2.CFrame = Part.CFrame * CFrame.new(0,0,i*-32)
end
end