Пример #1
0
        public void Initialise(IScene scene, IConfigSource source, ISimulationBase simBase)
        {
            IConfig PhysConfig    = source.Configs["Physics"];
            IConfig MeshingConfig = source.Configs["Meshing"];
            string  engine        = "";
            string  meshEngine    = "";
            string  Path          = "Physics";

            if (PhysConfig != null)
            {
                Path       = PhysConfig.GetString("PathToPhysicsAssemblies", Path);
                engine     = PhysConfig.GetString("DefaultPhysicsEngine", "OpenDynamicsEngine");
                meshEngine = MeshingConfig.GetString("DefaultMeshingEngine", "Meshmerizer");
                string regionName          = scene.RegionInfo.RegionName.Trim().Replace(' ', '_');
                string RegionPhysicsEngine = PhysConfig.GetString("Region_" + regionName + "_PhysicsEngine",
                                                                  String.Empty);
                if (RegionPhysicsEngine != "")
                {
                    engine = RegionPhysicsEngine;
                }
                string RegionMeshingEngine = MeshingConfig.GetString("Region_" + regionName + "_MeshingEngine",
                                                                     String.Empty);
                if (RegionMeshingEngine != "")
                {
                    meshEngine = RegionMeshingEngine;
                }
            }
            else
            {
                //Load Sane defaults
                engine     = "OpenDynamicsEngine";
                meshEngine = "Meshmerizer";
            }
            PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager();

            physicsPluginManager.LoadPluginsFromAssemblies(Util.BasePathCombine(Path));

            PhysicsScene pScene = physicsPluginManager.GetPhysicsScene(engine, meshEngine, source, scene);

            scene.PhysicsScene = pScene;
        }
        public void Initialise(IScene scene, IConfigSource source, ISimulationBase openSimBase)
        {
            IConfig PhysConfig = source.Configs["Physics"];
            IConfig MeshingConfig = source.Configs["Meshing"];
            string engine = "";
            string meshEngine = "";
            string Path = "Physics";
            if (PhysConfig != null)
            {
                Path = PhysConfig.GetString("PathToPhysicsAssemblies", Path);
                engine = PhysConfig.GetString("DefaultPhysicsEngine", "WhiteCoreOpenDynamicsEngine");
                meshEngine = MeshingConfig.GetString("DefaultMeshingEngine", "Meshmerizer");
                string regionName = scene.RegionInfo.RegionName.Trim().Replace(' ', '_');
                string RegionPhysicsEngine = PhysConfig.GetString("Region_" + regionName + "_PhysicsEngine",
                                                                  String.Empty);
                if (RegionPhysicsEngine != "")
                    engine = RegionPhysicsEngine;
                string RegionMeshingEngine = MeshingConfig.GetString("Region_" + regionName + "_MeshingEngine",
                                                                     String.Empty);
                if (RegionMeshingEngine != "")
                    meshEngine = RegionMeshingEngine;
            }
            else
            {
                //Load Sane defaults
                engine = "WhiteCoreOpenDynamicsEngine";
                meshEngine = "Meshmerizer";
            }
            PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager();
            physicsPluginManager.LoadPluginsFromAssemblies(Util.BasePathCombine(Path));

            PhysicsScene pScene = physicsPluginManager.GetPhysicsScene(engine, meshEngine, source, scene);
            scene.PhysicsScene = pScene;
        }