https://github.com/ogrew/unity-proceduralprimitives
Procedural builder for some basic primitives in Unity
https://github.com/ogrew/unity-proceduralprimitives
c-sharp generative mesh primitive procedural unity unity3d
Last synced: about 1 month ago
JSON representation
Procedural builder for some basic primitives in Unity
- Host: GitHub
- URL: https://github.com/ogrew/unity-proceduralprimitives
- Owner: ogrew
- License: mit
- Created: 2021-08-25T02:18:02.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-08-25T07:30:54.000Z (almost 5 years ago)
- Last Synced: 2025-06-19T06:38:15.898Z (12 months ago)
- Topics: c-sharp, generative, mesh, primitive, procedural, unity, unity3d
- Language: C#
- Homepage:
- Size: 68.4 KB
- Stars: 26
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Unity-ProceduralPrimitives
Procedural builder for some basic primitives in Unity
```
- Sphere
- Box
- Cylinder
- Capsule
- Torus
- Grid(Terrain)
- Polygon(Triangle, Rectangle, Circle etc..)
- Polyhedron
```
## Screenshots

## Usage
### [Sphere](https://github.com/ogrew/Unity-ProceduralPrimitives/blob/main/Assets/Scripts/3D/Sphere/SphereBuilder.cs)

```cs
_sphere.Generate(
radius: 1f,
level: 4,
_redMaterial
);
```
### [Box](https://github.com/ogrew/Unity-ProceduralPrimitives/blob/main/Assets/Scripts/3D/Box/BoxBuilder.cs)

```cs
_box.Generate(
width: 1f,
height: 1f,
depth: 1f,
segments: 4,
_yellowMaterial
);
```
### [Cylinder](https://github.com/ogrew/Unity-ProceduralPrimitives/blob/main/Assets/Scripts/3D/Cylinder/CylinderBuilder.cs)

```cs
_cylinder.Generate(
radialSegments: 24,
heightSegments: 24,
topRadius: 0.5f,
bottomRadius: 0.5f,
height: 2f,
_blueMaterial
);
```
### [Capsule](https://github.com/ogrew/Unity-ProceduralPrimitives/blob/main/Assets/Scripts/3D/Capsule/CapsuleBuilder.cs)

```cs
_capsule.Generate(
radius: 0.5f,
height: 1f,
lats: 16,
lons: 32,
rings: 2,
_redMaterial
);
```
### [Torus](https://github.com/ogrew/Unity-ProceduralPrimitives/blob/main/Assets/Scripts/3D/Torus/TorusBuilder.cs)

```cs
_torus.Generate(
majorRadius: .5f,
minorRadius: .25f,
majorSegment: 24,
minorSegment: 16,
_yellowMaterial
);
```
### [Grid(Terrain)](https://github.com/ogrew/Unity-ProceduralPrimitives/blob/main/Assets/Scripts/3D/Grid/GridBuilder.cs)

```cs
_grid.Generate(
width: 12f,
height: 6f,
divX: 12,
divY: 12,
_blueMaterial
);
```
### [Polygon](https://github.com/ogrew/Unity-ProceduralPrimitives/blob/main/Assets/Scripts/2D/PolygonBuilder.cs)

```cs
_polygon.Generate(
shape: 3,
size: 2f,
_redMaterial
);
```
### [Polyhedron](https://github.com/ogrew/Unity-ProceduralPrimitives/blob/main/Assets/Scripts/3D/Polyhedron/PolyhedronBuilder.cs)

```cs
_polyhedron.Generate(
type: SolidType.Icosahedron,
size: 1f,
_redMaterial
);
```
## License
MIT