Skip to content

Inverted geometry for procedural buildings #68

@z3nth10n

Description

@z3nth10n

Description

For some reason, creating a building with the desired foundation points it creates inverted buildings:

image
image
image

Version

  • Unity: 2019.4.11f
  • ProceduralToolkit: Latest commit -- not sure (using package manager)

Steps to reproduce

Just download the project using the package manager, then copy the Samples folder into a folder of the project. Then I created this script:

    public class BuildingPlanner : MonoSingleton<BuildingPlanner>
    {
        public ProceduralFacadeConstructor proceduralFacadeConstructor;
        public ProceduralFacadePlanner proceduralFacadePlanner;
        public ProceduralRoofConstructor proceduralRoofConstructor;
        public ProceduralRoofPlanner proceduralRoofPlanner;

        // Start is called before the first frame update
        private void Start()
        {
        }

        // Update is called once per frame
        private void Update()
        {
        }
    }

Which is a script with a singleton pattern instance implemented with MonoBehaviour.

Then I call this function for generating a building:

        private static BuildingGenerator GenerateBuilding(int buildingIndex, BuildingGenerator.Config config, out Transform generatedBuild)
        {
            var builds = GameObject.Find("Builds");

            if (builds == null)
                builds = new GameObject("Builds");

            var build = new GameObject("Build");
            build.transform.parent = builds.transform;

            var building = City.Instance.buildings.ElementAt(buildingIndex);
            var generator = new BuildingGenerator();
            {
                generator.SetFacadeConstructor(BuildingPlanner.Instance.proceduralFacadeConstructor);
                generator.SetFacadePlanner(BuildingPlanner.Instance.proceduralFacadePlanner);
                generator.SetRoofConstructor(BuildingPlanner.Instance.proceduralRoofConstructor);
                generator.SetRoofPlanner(BuildingPlanner.Instance.proceduralRoofPlanner);

                generatedBuild = generator.Generate(building.Pol.Edges.Select(x => CityGenerator.SConv.ConvertVector(x)).ToList(), config,
                    build.transform);
            }

            build.transform.position = City.GetBuildingCenter(building);

            return generator;
        }

Which generates a building froma json file which contains a dictionary (index and List).

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions