Example #1
0
        // ------------------------------------------------------------------------
        // end: cylinder


        // sphere
        // ------------------------------------------------------------------------

        public static void DrawSphere(Vector3 center, Quaternion rotation, float radius, int latSegments, int longSegments, Color color, bool depthTest = true)
        {
            Mesh mesh = PrimitiveMeshFactory.Sphere(latSegments, longSegments);

            if (mesh == null)
            {
                return;
            }

            Material material = GetMaterial(depthTest);
            MaterialPropertyBlock materialProperties = GetMaterialPropertyBlock();

            materialProperties.SetColor("_Color", color);
            materialProperties.SetVector("_Dimensions", new Vector4(radius, radius, radius, 0.0f));

            Graphics.DrawMesh(mesh, center, rotation, material, 0, null, 0, materialProperties, false, false, false);
        }