Stretching and compressing cylinder meshes

I often use cylinder meshes for stuff, but one thing that would be really useful is if cylinder meshes would stretch on their x and z axis so if your part is 2x2x1 the cylinder will be more like an oval rather than shrinking to 1x2x1 which is its current behavior.

Screen Shot 2015-12-18 at 1.07.15 PM.png

This is the current behavior. What I would like is if the cylinder mesh stretched so that it fills up the whole box and looks like an oval from the top.

6 Likes

It would be really nice (as currently no such mesh exists), but I don’t think having CylinderMesh do it would be the best, as it would break a number of models. I think a new SpecialMesh type would be better.

3 Likes

Or maybe a property of cylinder meshes that is false by default and has to be set to true for the cylinders to fill the box.

1 Like

I have been wanting this for a long time. Sphere meshes already do this, why can’t cylinder meshes? I say make the change and let the consequences be damned! The number of people who have weirdly-sized parts with cylinder meshes probably isn’t all that high.

Ugh, it’s bad enough that the Sphere mesh is a special mesh, but cylinders too? One thing I like about cylinder meshes is how easy it is to use: just double-click on it in the Basic Objects menu. With a sphere, you have to insert a SpecialMesh and then find it in the hierarchy and change the type from ‘Head’ to ‘Sphere’.

Green is BasePart.Shape Ball/Cylinder (Balls have their own collision box, and cylinders do too now.)
Blue is SpecialMesh.MeshType Sphere (They squish and stretch automatically)
Red is SpecialMesh.MeshType FileMesh (with the ID from Tom's Beans - Roblox, so http://www.roblox.com/asset/?id=103919751)

blob.png

Item = game.Selection:Get()[1] Item.Mesh.Scale = Vector3.new(Item.Size.X * 1.285, Item.Size.Y, Item.Size.Z * 1.285)

blob.png

If someone comes across a better CylinderMesh or I find a better one, I’ll edit this post.


I agree we’d like something like the SpecialMesh.MeshType Sphere but for Cylinder that automatically stretches, squishes, and fills in the bounds.


Edit: Here are all the cylinder related meshes that didn’t make the cut. Without tags we have to go through 40 pages on the catalog.
blob.png

This is a union, but it’s a cylinder that can be compressed/stretched without the little rings at the ends:

Now with box physics, we shouldn’t have any issues with performance either.

Here’s some plugin code to generate one (Base ellipse creation code by @AxisAngle ;)):

function drawFilledCylinder(centerCFrame,xRadius,yRadius,height,sides)
	local Model=Instance.new("Model",game.Workspace)
	local LastPoint=Vector3.new(xRadius,0,0)
	for i=1,sides do
		local Angle=i*2*math.pi/sides
		local CurrentPoint=Vector3.new(xRadius*math.cos(Angle),0,yRadius*math.sin(Angle))
		local Part=Instance.new("Part",Model)
		Part.Anchored=true
		Part.FormFactor="Custom"
		local Dist=(CurrentPoint-LastPoint).magnitude
		Part.Size=Vector3.new(math.min(xRadius,yRadius),height,Dist)
		Part.CFrame=centerCFrame*CFrame.new(LastPoint,CurrentPoint)*CFrame.new(math.min(xRadius,yRadius)/2,0,-Dist/2)
		LastPoint=CurrentPoint
	end
	return Model
end


_G.createCylinder = function(x,y,z,sides)
	sides = sides or 16
	local p = (workspace.CurrentCamera.CoordinateFrame * CFrame.new(0,0,-10)).p
	local cylinder = drawFilledCylinder(CFrame.new(p),x/2,y/2,z,sides)
	local success,error = pcall(function()
		plugin:Union(cylinder:GetChildren())
	end)
	if success then
		cylinder:GetChildren()[1].Parent = workspace
		cylinder:Destroy()	
	else
		error("Could not union parts. Try manually?")
	end
end

Maybe malformed cylinders are something for @M0RGOTH’s CSG primitives plugin?

1 Like

Nice, gets rid of the lip. Can’t union in an online game though, and can’t stretch and squish it online/in studio once it’s made (see pic.)
blob.png

Both workarounds have pros and cons depending on what you’re doing q_q Unless someone finds a FileMesh from like the MeshDB person that doesn’t have a lip.

Yeah it wasn’t meant to be a complete solution. Just something you can do in studio to avoid the weird edges at the top of that cylinderish mesh you found.

Does this take into account roblox’s weird circle thing where the points are bunched closer at the 45 and more spread out at the 0 and the 90?

:open_mouth: nice!

Yes I should add this to my plugin. I should add a bunch of features I’ve planned over the next few days…