Unity-ProceduralPrimitives icon indicating copy to clipboard operation
Unity-ProceduralPrimitives copied to clipboard

Procedural builder for some basic primitives in Unity

trafficstars

Unity-ProceduralPrimitives

Procedural builder for some basic primitives in Unity

- Sphere
- Box
- Cylinder
- Capsule
- Torus
- Grid(Terrain)
- Polygon(Triangle, Rectangle, Circle etc..)
- Polyhedron

Screenshots

image

Usage

Sphere

image

        _sphere.Generate(
            radius: 1f,
            level: 4,
            _redMaterial
        );

Box

image

        _box.Generate(
            width: 1f,
            height: 1f,
            depth: 1f,
            segments: 4, 
            _yellowMaterial
        );

Cylinder

image

        _cylinder.Generate(
            radialSegments: 24,
            heightSegments: 24,
            topRadius: 0.5f,
            bottomRadius: 0.5f,
            height: 2f,
            _blueMaterial
        );

Capsule

image

        _capsule.Generate(
            radius: 0.5f,
            height: 1f,
            lats: 16,
            lons: 32,
            rings: 2,
            _redMaterial
        );

Torus

image

        _torus.Generate(
            majorRadius: .5f,
            minorRadius: .25f,
            majorSegment: 24,
            minorSegment: 16,
            _yellowMaterial
        );

Grid(Terrain)

image

        _grid.Generate(
            width: 12f,
            height: 6f,
            divX: 12,
            divY: 12,
            _blueMaterial
        );

Polygon

image

        _polygon.Generate(
            shape: 3,
            size: 2f,
            _redMaterial
        );

Polyhedron

image

        _polyhedron.Generate(
            type: SolidType.Icosahedron,
            size: 1f,
            _redMaterial
        );

License

MIT