This might sound like a stupid question but I seriously have no idea how to get the radius and height of a cylinder. I’m trying to fill with air with a specific cylinder size/rotation inside of water, with Terrain.FillCylinder:. I can get the CFrame of the cylinder, but not the radius since there’s no such command as "print:(workspace.Cylinder.Radius)" How can I find those numbers?
Full code:
workspace.Terrain:FillCylinder(workspace.CylinderWaterClear1.CFrame, -, -, Enum.Material.Water) --P.S. ignore the "-", I put that because I don't know the number to put instead.
If it is a part get the smaller size in either the z or the y:
getRadius = function(part)
return (part.Size.Z<part.Size.Y and part.Size.Z or part.Size.Y)/2
--[[In the above we are returning the smallest, first we check if Z is smaller
than Y, if so then we return Z or else we return Y.]]
end;
Where to put the part’s location/name exactly (such as workspace.Cylinder)? And how do I make it print the result number in output? (I’m a bit new to scripting, sorry)
Well yes, but if you want you can use the function to reduce the times you call that formula.
local radius1 = (part.Size.Z<part.Size.Y and part.Size.Z or part.Size.Y)/2
local radius2 = (part2.Size.Z<part2.Size.Y and part2.Size.Z or part2.Size.Y)/2
local radius3 = (part3.Size.Z<part3.Size.Y and part3.Size.Z or part3.Size.Y)/2
Is more messy than:
getRadius = function(part)
return (part.Size.Z<part.Size.Y and part.Size.Z or part.Size.Y)/2
end;
getHeight = function(part) return part.Size.X end;
local radius1 = getRadius(part);
local radius2 = getRadius(part2);
local radius3 = getRadius(part3);