/// <summary>
        /// Get a new physics scene.
        /// </summary>
        /// <param name="engine">The name of the physics engine to use</param>
        /// <param name="meshEngine">The name of the mesh engine to use</param>
        /// <param name="config">The configuration data to pass to the physics and mesh engines</param>
        /// <param name="osSceneIdentifier">
        /// The name of the OpenSim scene this physics scene is serving.  This will be used in log messages.
        /// </param>
        /// <returns></returns>
        protected PhysicsScene GetPhysicsScene(
            string engine, string meshEngine, IConfigSource config, string osSceneIdentifier, Vector3 regionExtent)
        {
            PhysicsPluginManager physicsPluginManager;

            physicsPluginManager = new PhysicsPluginManager();
            physicsPluginManager.LoadPluginsFromAssemblies("Physics");

            return(physicsPluginManager.GetPhysicsScene(engine, meshEngine, config, osSceneIdentifier, regionExtent));
        }
Example #2
0
        // 'engineName' is the Bullet engine to use. Either null (for unmanaged), "BulletUnmanaged" or "BulletXNA"
        // 'params' is a set of keyValue pairs to set in the engine's configuration file (override defaults)
        //      May be 'null' if there are no overrides.
        public static BSScene CreateBasicPhysicsEngine(Dictionary <string, string> paramOverrides)
        {
            IConfigSource openSimINI    = new IniConfigSource();
            IConfig       startupConfig = openSimINI.AddConfig("Startup");

            startupConfig.Set("physics", "BulletSim");
            startupConfig.Set("meshing", "Meshmerizer");
            startupConfig.Set("cacheSculptMaps", "false"); // meshmerizer shouldn't save maps

            IConfig bulletSimConfig = openSimINI.AddConfig("BulletSim");

            // If the caller cares, specify the bullet engine otherwise it will default to "BulletUnmanaged".
            // bulletSimConfig.Set("BulletEngine", "BulletUnmanaged");
            // bulletSimConfig.Set("BulletEngine", "BulletXNA");
            bulletSimConfig.Set("MeshSculptedPrim", "false");
            bulletSimConfig.Set("ForceSimplePrimMeshing", "true");
            if (paramOverrides != null)
            {
                foreach (KeyValuePair <string, string> kvp in paramOverrides)
                {
                    bulletSimConfig.Set(kvp.Key, kvp.Value);
                }
            }

            // If a special directory exists, put detailed logging therein.
            // This allows local testing/debugging without having to worry that the build engine will output logs.
            if (Directory.Exists("physlogs"))
            {
                bulletSimConfig.Set("PhysicsLoggingDir", "./physlogs");
                bulletSimConfig.Set("PhysicsLoggingEnabled", "True");
                bulletSimConfig.Set("PhysicsLoggingDoFlush", "True");
                bulletSimConfig.Set("VehicleLoggingEnabled", "True");
            }

            PhysicsPluginManager physicsPluginManager;

            physicsPluginManager = new PhysicsPluginManager();
            physicsPluginManager.LoadPluginsFromAssemblies("Physics");

            Vector3 regionExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight);

            PhysicsScene pScene = physicsPluginManager.GetPhysicsScene(
                "BulletSim", "Meshmerizer", openSimINI, "BSTestRegion", regionExtent);

            BSScene bsScene = pScene as BSScene;

            // Since the asset requestor is not initialized, any mesh or sculptie will be a cube.
            // In the future, add a fake asset fetcher to get meshes and sculpts.
            // bsScene.RequestAssetMethod = ???;

            return(bsScene);
        }
Example #3
0
        /// <summary>
        /// Get a new physics scene.
        /// </summary>
        /// <param name="engine">The name of the physics engine to use</param>
        /// <param name="meshEngine">The name of the mesh engine to use</param>
        /// <param name="config">The configuration data to pass to the physics and mesh engines</param>
        /// <param name="osSceneIdentifier">
        /// The name of the OpenSim scene this physics scene is serving.  This will be used in log messages.
        /// </param>
        /// <returns></returns>
        protected PhysicsScene GetPhysicsScene(
            string engine, string meshEngine, IConfigSource config, string osSceneIdentifier)
        {
            if (m_log.IsDebugEnabled)
            {
                m_log.DebugFormat("{0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
            }

            PhysicsPluginManager physicsPluginManager;

            physicsPluginManager = new PhysicsPluginManager();
            physicsPluginManager.LoadPluginsFromAssemblies("Physics");

            return(physicsPluginManager.GetPhysicsScene(engine, meshEngine, config, osSceneIdentifier));
        }
Example #4
0
        public void Initialise(Scene 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", "AuroraOpenDynamicsEngine");
                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     = "AuroraOpenDynamicsEngine";
                meshEngine = "Meshmerizer";
            }
            PhysicsPluginManager physicsPluginManager = new PhysicsPluginManager();

            physicsPluginManager.LoadPluginsFromAssemblies(Path);

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

            scene.PhysicsScene = pScene;
        }