8000 GitHub - MechWarrior99/pb_CSG: A C# port of CSG.js by Evan W (http://evanw.github.io/csg.js/).
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

MechWarrior99/pb_CSG

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

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
Mesh m = CSG.Subtract(cube, sphere);

// Create a gameObject to render the result
composite = new GameObject();
composite.AddComponent<MeshFilter>().sharedMesh = m;
composite.AddComponent<MeshRenderer>().sharedMaterial = myMaterial;

Result:

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 52.5%
  • JavaScript 34.9%
  • HTML 7.1%
  • CSS 3.2%
  • ShaderLab 2.3%
0