Ejemplo n.º 1
0
        /// <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);
        }
Ejemplo n.º 2
0
 private void Start()
 {
     GetComponent <MeshFilter>().mesh = MeshE.Cylinder(radius, segments, height);
 }
Ejemplo n.º 3
0
 public static void Cylinder()
 {
     PrimitiveTemplate(cylinder, () => MeshE.Cylinder(1, 16, 1));
 }