private bool AddRobotGeom()

in unity/Assets/Scripts/RobotLoader.cs [643:679]


    private bool AddRobotGeom(KineticHierarchyController parent, XmlNode geom_xml, XmlUtils.Defaults defaults) {
        defaults = defaults.Resolve(XmlUtils.GetString(geom_xml, "class", null)).GetSubclass("geom");

        GeomController geom = null;

        string mesh_name = XmlUtils.GetStringWithDefaults(geom_xml, defaults, "mesh", null);
        string type = XmlUtils.GetStringWithDefaults(geom_xml, defaults, "type", null);

        if (mesh_name != null) {
            geom = AddRobotMeshGeom(parent, geom_xml, defaults, mesh_name);
        } else if ("box".Equals(type)) {
            geom = AddRobotBoxGeom(parent, geom_xml, defaults);
        } else if ("plane".Equals(type)) {
            geom = AddRobotPlaneGeom(parent, geom_xml, defaults);
        } else if (type == null || "sphere".Equals(type)) {
            geom = AddRobotSphereGeom(parent, geom_xml, defaults);
        } else if ("cylinder".Equals(type)) {
            geom = AddRobotCylinderGeom(parent, geom_xml, defaults);
        } else if ("capsule".Equals(type)) {
            geom = AddRobotCapsuleGeom(parent, geom_xml, defaults);
        } else {
            Logger.Error("RobotLoader::AddRobotGeom::Unsupported geom type: {0} in {1}.", type, geom_xml.OuterXml);
            return false;
        }

        if (geom == null) {
            Logger.Error("RobotLoader::AddRobotGeom::Cannot instantiate geom.");
            return false;
        }

        // Set the geom category for semantic segmentation
        UpdateGeomCategory(geom, geom_xml);

        // Find the material in the preloaded assets.
        ResolveMaterial(geom_xml, defaults, geom);
        return true;
    }