/// <summary> /// Returns a cylindrical mesh to fit a ring shape with given radius. Cylinder will have the given number of sides, and height. /// </summary> static Mesh CreateCylinderMesh(int sides, float radius, float height) { // circumradius = r sec(π/n) var circumradius = radius * 1 / Mathf.Cos(Mathf.PI / sides); var cylinderMesh = MeshE.Cylinder(circumradius, sides, height); cylinderMesh.Rotate(Quaternion.Euler(0f, (360f / sides) / 2f, 0f)); return(cylinderMesh); }
private void Start() { GetComponent <MeshFilter>().mesh = MeshE.Cylinder(radius, segments, height); }
public static void Cylinder() { PrimitiveTemplate(cylinder, () => MeshE.Cylinder(1, 16, 1)); }