From 872d513daaa68b94b78f71bd2a2d9a0f117ff727 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Mon, 26 Mar 2012 17:36:33 -0700 Subject: BulletSim: make avatar animations update properly. It seems that ODE calls the avatar collision handling routine even if there are no collisions. This causes the animation to be updated. So, for instance, going from HOVER to FLY is caused by the physics engine calling the collision routine each frame with 0 collisions. --- .../Region/Physics/BulletSPlugin/BSCharacter.cs | 24 ++++++++++++++++++---- OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 18 +++++++++++----- OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 15 ++++++++++++++ 3 files changed, 48 insertions(+), 9 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index 20708d9..b08d5db 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs @@ -426,6 +426,8 @@ public class BSCharacter : PhysicsActor } } + // Called by the scene when a collision with this object is reported + CollisionEventUpdate collisionCollection = null; public void Collide(uint collidingWith, ActorTypes type, Vector3 contactPoint, Vector3 contactNormal, float pentrationDepth) { // m_log.DebugFormat("{0}: Collide: ms={1}, id={2}, with={3}", LogHeader, _subscribedEventsMs, LocalID, collidingWith); @@ -443,10 +445,24 @@ public class BSCharacter : PhysicsActor if (nowTime < (_lastCollisionTime + _subscribedEventsMs)) return; _lastCollisionTime = nowTime; - Dictionary contactPoints = new Dictionary(); - contactPoints.Add(collidingWith, new ContactPoint(contactPoint, contactNormal, pentrationDepth)); - CollisionEventUpdate args = new CollisionEventUpdate(contactPoints); - base.SendCollisionUpdate(args); + if (collisionCollection == null) + collisionCollection = new CollisionEventUpdate(); + collisionCollection.AddCollider(collidingWith, new ContactPoint(contactPoint, contactNormal, pentrationDepth)); + } + + public void SendCollisions() + { + // if (collisionCollection != null) + // { + // base.SendCollisionUpdate(collisionCollection); + // collisionCollection = null; + // } + // Kludge to make a collision call even if there are no collisions. + // This causes the avatar animation to get updated. + if (collisionCollection == null) + collisionCollection = new CollisionEventUpdate(); + base.SendCollisionUpdate(collisionCollection); + collisionCollection = null; } } diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index f122df9..248d1f2 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs @@ -1326,6 +1326,7 @@ public sealed class BSPrim : PhysicsActor } // I've collided with something + CollisionEventUpdate collisionCollection = null; public void Collide(uint collidingWith, ActorTypes type, OMV.Vector3 contactPoint, OMV.Vector3 contactNormal, float pentrationDepth) { // m_log.DebugFormat("{0}: Collide: ms={1}, id={2}, with={3}", LogHeader, _subscribedEventsMs, LocalID, collidingWith); @@ -1343,11 +1344,18 @@ public sealed class BSPrim : PhysicsActor if (nowTime < (_lastCollisionTime + _subscribedEventsMs)) return; _lastCollisionTime = nowTime; - // create the event for the collision - Dictionary contactPoints = new Dictionary(); - contactPoints.Add(collidingWith, new ContactPoint(contactPoint, contactNormal, pentrationDepth)); - CollisionEventUpdate args = new CollisionEventUpdate(contactPoints); - base.SendCollisionUpdate(args); + if (collisionCollection == null) + collisionCollection = new CollisionEventUpdate(); + collisionCollection.AddCollider(collidingWith, new ContactPoint(contactPoint, contactNormal, pentrationDepth)); + } + + public void SendCollisions() + { + if (collisionCollection != null) + { + base.SendCollisionUpdate(collisionCollection); + collisionCollection = null; + } } } } diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index 581d540..94a0ccf 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs @@ -78,6 +78,8 @@ public class BSScene : PhysicsScene, IPhysicsParameters private Dictionary m_avatars = new Dictionary(); private Dictionary m_prims = new Dictionary(); + private HashSet m_avatarsWithCollisions = new HashSet(); + private HashSet m_primsWithCollisions = new HashSet(); private List m_vehicles = new List(); private float[] m_heightMap; private float m_waterLevel; @@ -435,6 +437,17 @@ public class BSScene : PhysicsScene, IPhysicsParameters } } + // The SendCollision's batch up the collisions on the objects. Now push the collisions into the simulator. + foreach (BSPrim bsp in m_primsWithCollisions) + bsp.SendCollisions(); + m_primsWithCollisions.Clear(); + // foreach (BSCharacter bsc in m_avatarsWithCollisions) + // bsc.SendCollisions(); + // This is a kludge to get avatar movement updated. ODE sends collisions even if there isn't any + foreach (KeyValuePair kvp in m_avatars) + kvp.Value.SendCollisions(); + m_avatarsWithCollisions.Clear(); + // If any of the objects had updated properties, tell the object it has been changed by the physics engine if (updatedEntityCount > 0) { @@ -485,11 +498,13 @@ public class BSScene : PhysicsScene, IPhysicsParameters BSPrim prim; if (m_prims.TryGetValue(localID, out prim)) { prim.Collide(collidingWith, type, collidePoint, collideNormal, penitration); + m_primsWithCollisions.Add(prim); return; } BSCharacter actor; if (m_avatars.TryGetValue(localID, out actor)) { actor.Collide(collidingWith, type, collidePoint, collideNormal, penitration); + m_avatarsWithCollisions.Add(actor); return; } return; -- cgit v1.1 From 1aa1a9eb3d3f5690c7ff0dff9ff843f2e638bb6d Mon Sep 17 00:00:00 2001 From: Garmin Kawaguichi Date: Sun, 25 Mar 2012 16:25:41 +0200 Subject: In TerrainModule.cs, the command terrain save-tile is modified to remove an unnecessary double argument "minimum Y tile" --- OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | 2 -- 1 file changed, 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index 17e9737..b3c2969 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs @@ -1197,8 +1197,6 @@ namespace OpenSim.Region.CoreModules.World.Terrain saveToTileCommand.AddArgument("file height", "The height of the file in tiles", "Integer"); saveToTileCommand.AddArgument("minimum X tile", "The X region coordinate of the first section on the file", "Integer"); - saveToTileCommand.AddArgument("minimum Y tile", "The Y region coordinate of the first section on the file", - "Integer"); saveToTileCommand.AddArgument("minimum Y tile", "The Y region coordinate of the first tile on the file\n" + "= Example =\n" + "To save a PNG file for a set of map tiles 2 regions wide and 3 regions high from map co-ordinate (9910,10234)\n" -- cgit v1.1 From 8131a24cde3f3877b3b8dd850871c57c17b2b216 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 27 Mar 2012 10:08:13 -0700 Subject: Send the config section name up to the service classes themselves (XInventory and Assets). --- .../Server/Handlers/Asset/AssetServerConnector.cs | 2 +- .../Handlers/Inventory/XInventoryInConnector.cs | 2 +- OpenSim/Services/AssetService/AssetService.cs | 11 ++++-- OpenSim/Services/AssetService/AssetServiceBase.cs | 15 ++++++-- .../Services/HypergridService/HGAssetService.cs | 4 +-- .../HypergridService/HGInventoryService.cs | 40 ++++------------------ .../Services/InventoryService/XInventoryService.cs | 12 +++++-- 7 files changed, 40 insertions(+), 46 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs index 8b9e749..46b0c67 100644 --- a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs +++ b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs @@ -59,7 +59,7 @@ namespace OpenSim.Server.Handlers.Asset if (assetService == String.Empty) throw new Exception("No LocalServiceModule in config file"); - Object[] args = new Object[] { config }; + Object[] args = new Object[] { config, m_ConfigName }; m_AssetService = ServerUtils.LoadPlugin(assetService, args); diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index 9d6f964..040c840 100644 --- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs @@ -67,7 +67,7 @@ namespace OpenSim.Server.Handlers.Asset if (inventoryService == String.Empty) throw new Exception("No InventoryService in config file"); - Object[] args = new Object[] { config }; + Object[] args = new Object[] { config, m_ConfigName }; m_InventoryService = ServerUtils.LoadPlugin(inventoryService, args); diff --git a/OpenSim/Services/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs index 4f4cbf6..137a9b0 100644 --- a/OpenSim/Services/AssetService/AssetService.cs +++ b/OpenSim/Services/AssetService/AssetService.cs @@ -46,7 +46,12 @@ namespace OpenSim.Services.AssetService protected static AssetService m_RootInstance; - public AssetService(IConfigSource config) : base(config) + public AssetService(IConfigSource config) + : this(config, "AssetService") + { + } + + public AssetService(IConfigSource config, string configName) : base(config, configName) { if (m_RootInstance == null) { @@ -54,9 +59,9 @@ namespace OpenSim.Services.AssetService if (m_AssetLoader != null) { - IConfig assetConfig = config.Configs["AssetService"]; + IConfig assetConfig = config.Configs[m_ConfigName]; if (assetConfig == null) - throw new Exception("No AssetService configuration"); + throw new Exception("No " + m_ConfigName + " configuration"); string loaderArgs = assetConfig.GetString("AssetLoaderArgs", String.Empty); diff --git a/OpenSim/Services/AssetService/AssetServiceBase.cs b/OpenSim/Services/AssetService/AssetServiceBase.cs index 86752f9..177c565 100644 --- a/OpenSim/Services/AssetService/AssetServiceBase.cs +++ b/OpenSim/Services/AssetService/AssetServiceBase.cs @@ -39,16 +39,25 @@ namespace OpenSim.Services.AssetService { protected IAssetDataPlugin m_Database = null; protected IAssetLoader m_AssetLoader = null; + protected string m_ConfigName = "AssetService"; - public AssetServiceBase(IConfigSource config) : base(config) + public AssetServiceBase(IConfigSource config) + : this(config, "AssetService") { + } + + public AssetServiceBase(IConfigSource config, string configName) : base(config) + { + if (configName != string.Empty) + m_ConfigName = configName; + string dllName = String.Empty; string connString = String.Empty; // - // Try reading the [AssetService] section first, if it exists + // Try reading the [AssetService] section, if it exists // - IConfig assetConfig = config.Configs["AssetService"]; + IConfig assetConfig = config.Configs[m_ConfigName]; if (assetConfig != null) { dllName = assetConfig.GetString("StorageProvider", dllName); diff --git a/OpenSim/Services/HypergridService/HGAssetService.cs b/OpenSim/Services/HypergridService/HGAssetService.cs index 22e233a..db98166 100644 --- a/OpenSim/Services/HypergridService/HGAssetService.cs +++ b/OpenSim/Services/HypergridService/HGAssetService.cs @@ -58,10 +58,10 @@ namespace OpenSim.Services.HypergridService private UserAccountCache m_Cache; - public HGAssetService(IConfigSource config) : base(config) + public HGAssetService(IConfigSource config, string configName) : base(config, configName) { m_log.Debug("[HGAsset Service]: Starting"); - IConfig assetConfig = config.Configs["HGAssetService"]; + IConfig assetConfig = config.Configs[configName]; if (assetConfig == null) throw new Exception("No HGAssetService configuration"); diff --git a/OpenSim/Services/HypergridService/HGInventoryService.cs b/OpenSim/Services/HypergridService/HGInventoryService.cs index 41d5a7a..a1287fd 100644 --- a/OpenSim/Services/HypergridService/HGInventoryService.cs +++ b/OpenSim/Services/HypergridService/HGInventoryService.cs @@ -60,36 +60,19 @@ namespace OpenSim.Services.HypergridService private UserAccountCache m_Cache; - public HGInventoryService(IConfigSource config) - : base(config) + public HGInventoryService(IConfigSource config, string configName) + : base(config, configName) { m_log.Debug("[HGInventory Service]: Starting"); - - string dllName = String.Empty; - string connString = String.Empty; - //string realm = "Inventory"; // OSG version doesn't use this - - // - // Try reading the [DatabaseService] section, if it exists - // - IConfig dbConfig = config.Configs["DatabaseService"]; - if (dbConfig != null) - { - if (dllName == String.Empty) - dllName = dbConfig.GetString("StorageProvider", String.Empty); - if (connString == String.Empty) - connString = dbConfig.GetString("ConnectionString", String.Empty); - } + if (configName != string.Empty) + m_ConfigName = configName; // // Try reading the [InventoryService] section, if it exists // - IConfig invConfig = config.Configs["HGInventoryService"]; + IConfig invConfig = config.Configs[m_ConfigName]; if (invConfig != null) - { - dllName = invConfig.GetString("StorageProvider", dllName); - connString = invConfig.GetString("ConnectionString", connString); - + { // realm = authConfig.GetString("Realm", realm); string userAccountsDll = invConfig.GetString("UserAccountsService", string.Empty); if (userAccountsDll == string.Empty) @@ -108,17 +91,6 @@ namespace OpenSim.Services.HypergridService m_Cache = UserAccountCache.CreateUserAccountCache(m_UserAccountService); } - // - // We tried, but this doesn't exist. We can't proceed. - // - if (dllName == String.Empty) - throw new Exception("No StorageProvider configured"); - - m_Database = LoadPlugin(dllName, - new Object[] {connString, String.Empty}); - if (m_Database == null) - throw new Exception("Could not find a storage interface in the given module"); - m_log.Debug("[HG INVENTORY SERVICE]: Starting..."); } diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index 1648b51..8c57d17 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs @@ -46,9 +46,17 @@ namespace OpenSim.Services.InventoryService protected IXInventoryData m_Database; protected bool m_AllowDelete = true; + protected string m_ConfigName = "InventoryService"; - public XInventoryService(IConfigSource config) : base(config) + public XInventoryService(IConfigSource config) + : this(config, "InventoryService") { + } + public XInventoryService(IConfigSource config, string configName) : base(config) + { + if (configName != string.Empty) + m_ConfigName = configName; + string dllName = String.Empty; string connString = String.Empty; //string realm = "Inventory"; // OSG version doesn't use this @@ -56,7 +64,7 @@ namespace OpenSim.Services.InventoryService // // Try reading the [InventoryService] section first, if it exists // - IConfig authConfig = config.Configs["InventoryService"]; + IConfig authConfig = config.Configs[m_ConfigName]; if (authConfig != null) { dllName = authConfig.GetString("StorageProvider", dllName); -- cgit v1.1