예제 #1
0
    private void InitScenario()
    {
        // First release any previously loaded objects
        foreach (GameObject car in cars)
        {
            Destroy(car);
        }
        cars.Clear();

        if (envModel != null)
        {
            Destroy(envModel);
        }


        if (ESMiniLib.SE_Init(Application.streamingAssetsPath + OSC_filename,
                              disable_controllers ? 1 : 0,
                              OSG_visualization ? 1 : 0,
                              threads ? 1 : 0,
                              0) != 0) // don't create .dat-recording for replayer
        {
            print("failed to load scenario");
            return;
        }

        // Load environment 3D model
        string sceneGraphFilename = Marshal.PtrToStringAnsi(ESMiniLib.SE_GetSceneGraphFilename());

        Debug.Log("Loading " + Path.GetFileNameWithoutExtension(sceneGraphFilename));
        envModel = (GameObject)Instantiate(Resources.Load(Path.GetFileNameWithoutExtension(sceneGraphFilename)));
    }
예제 #2
0
    private void InitScenario()
    {
        // First release any previously loaded objects
        foreach (GameObject car in cars)
        {
            Destroy(car);
        }
        cars.Clear();

        if (envModel != null)
        {
            Destroy(envModel);
        }


        if (ESMiniLib.SE_Init(Application.streamingAssetsPath + OSC_filename,
                              disable_controllers ? 1 : 0,
                              OSG_visualization ? 1 : 0,
                              threads ? 1 : 0,
                              0) != 0) // don't create .dat-recording for replayer
        {
            print("failed to load scenario");
            return;
        }

        // Load environment 3D model
        string sceneGraphFilename = Marshal.PtrToStringAnsi(ESMiniLib.SE_GetSceneGraphFilename());

        Debug.Log("Loading " + Path.GetFileNameWithoutExtension(sceneGraphFilename));
        envModel = (GameObject)Instantiate(Resources.Load(Path.GetFileNameWithoutExtension(sceneGraphFilename)));

        // Fetch names of entities within the scenario
        int nObjects = ESMiniLib.SE_GetNumberOfObjects();

        for (int i = 0; i < nObjects; i++)
        {
            string typeName      = Marshal.PtrToStringAnsi(ESMiniLib.SE_GetObjectTypeName(i));
            string objectName    = Marshal.PtrToStringAnsi(ESMiniLib.SE_GetObjectName(i));
            string modelFileName = Marshal.PtrToStringAnsi(ESMiniLib.SE_GetObjectModelFileName(i));
            Debug.Log("Object[" + i + "]: " + objectName + " (type: " + typeName + ", model: " + modelFileName + ")");
        }
    }