We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add this to ./Building/Runtime/ProceduralRoof.cs
./Building/Runtime/ProceduralRoof.cs
public class ProceduralConicalRoof : ProceduralRoof { public ProceduralConicalRoof(List<Vector2> foundationPolygon, RoofConfig roofConfig, Color roofColor) : base(foundationPolygon, roofConfig, roofColor) { } public override MeshDraft Construct(Vector2 parentLayoutOrigin) { var roofDraft = ConstructRoofBase(out List<Vector2> roofPolygon2, out List<Vector3> roofPolygon3); List<Vector3> upperRing = roofPolygon2.ConvertAll(v => v.ToVector3XZ() + Vector3.up * roofConfig.thickness); var centerPoint = FindCenter(upperRing); /// Arbitrary: roof height is radius of the base /// float centerPointHeight = Vector3.Distance(centerPoint, upperRing[0]); centerPoint += Vector3.up * centerPointHeight; for (int i = 0; i < upperRing.Count - 1; i++) { roofDraft.AddTriangle(upperRing[i], upperRing[i+1], centerPoint, true); } // Add last triangle ([end] to [start]) roofDraft.AddTriangle(upperRing[upperRing.Count - 1] , upperRing[0], centerPoint, true); return roofDraft.Paint(roofColor); } private Vector3 FindCenter(List<Vector3> polygon) { Vector3 pos = Vector3.zero; foreach(Vector3 v in polygon) { pos += v; } return pos / polygon.Count; }
The text was updated successfully, but these errors were encountered:
If you want to use the fancy Primitives:
public override MeshDraft Construct(Vector2 parentLayoutOrigin) { var roofDraft = ConstructRoofBase(out List<Vector2> roofPolygon2, out List<Vector3> roofPolygon3); List<Vector3> upperRing = roofPolygon2.ConvertAll(v => v.ToVector3XZ() + Vector3.up * roofConfig.thickness); var centerPoint = FindCenter(upperRing); float centerPointHeight = Vector3.Distance(centerPoint, upperRing[0]); centerPoint += Vector3.up * centerPointHeight; roofDraft.AddBaselessPyramid(centerPoint, upperRing, true, false); return roofDraft.Paint(roofColor); }
Sorry, something went wrong.
BasmanovDaniil
No branches or pull requests
Add this to
./Building/Runtime/ProceduralRoof.cs
The text was updated successfully, but these errors were encountered: