I am making a cave generation system for my game and I am currently trying to optimize it, I figured I could use terrain cylinders instead of a whole bunch of air spheres, however I am struggling to actually have the (air) terrain cylinder connect the two points because I am pretty bad at CFrames.
I have tried to change the order of the CFrames, changing the math.rad() values and yet I can’t get any closer.
Function to place the cylinder (pos1 and pos2 being the positions to connect and size being the radius of the cylinder)
local function generateConnectionCylinder(pos1, pos2, material, size)
workspace.Terrain:FillCylinder(CFrame.new((pos1+pos2)/2) * CFrame.Angles(math.rad(90), 0, 0) * CFrame.lookAt(pos1, pos2), (pos1-pos2).magnitude, size, material)
end
I don’t think however that the issue is in the main script but instead in the function I gave, if that isn’t the case just let me know if I should give you the cave generation code itself. Thanks in advance
unfortunately this didn’t work, I tried tweaking some values here and there but yet couldn’t really get any closer… I appreciate the effort, tho, so thanks a lot for that
It seems to be working fine on my end. I’ve attached a demo that draws a cylinder between two parts every 10 seconds. You just have to run it and move them around.
that’s odd, I’ll try again, hopefully it works that time or something.
Welp that didn’t work when putting that script into my game, the issue must come from where the function is called… I’ll just try troubleshooting a bit more
Alr, thanks a lot for the help! Unfortunately tho I’m not sure if I’ll keep the cylinder system because it just doesn’t really look as good as the old system… If I need to optimize my game tho, I will have WAY less trouble. Thanks a lot for your help!
EDIT: I’m using the cylinder system now, I am really happy with the result and cannot thank you enough!