Skip to content
forked from karl-/pb_CSG

A C# port of CSG.js by Evan W (http://evanw.github.io/csg.js/).

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE.meta
Notifications You must be signed in to change notification settings

pspkurara/pb_CSG

 
 

Repository files navigation

pb_CSG

A C# port of CSG.js by Evan W for use in the Unity game engine.

Quick Start

pb_CSG provides an interface in the CSG class for creating new meshes from boolean operations. Each function (Union, Subtract, Intersect) accepts 2 gameObjects: the left and right side. A new mesh is returned.

Example use:

// Include the library
using Parabox.CSG;

...

// Initialize two new meshes in the scene
GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
GameObject sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);
sphere.transform.localScale = Vector3.one * 1.3;

// Perform boolean operation
CSG_Model result = Boolean.Subtract(cube, sphere);

// Create a gameObject to render the result
composite = new GameObject();
composite.AddComponent<MeshFilter>().sharedMesh = result.mesh;
composite.AddComponent<MeshRenderer>().sharedMaterials = result.materials.ToArray();

Result:

About

A C# port of CSG.js by Evan W (http://evanw.github.io/csg.js/).

Resources

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE.meta

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 66.4%
  • JavaScript 25.9%
  • HTML 5.3%
  • CSS 2.4%