From 48113f0fc811f21f4a113176caa9dbd78c0d3446 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 22 Dec 2011 19:44:52 +0000 Subject: [PATCH 1/8] Make it possible to force all prims to be phantom via the collidable_prim boolean setting in the OpenSim.ini config [Startup] section. Naturally, default is true. When set to false, "phantom" flags on prims can be set as usual but all prims remain phantom. This setting is for test purposes. This switch does not affect the collision of avatars with the terrain. --- OpenSim/Region/Framework/Scenes/Scene.cs | 9 +++++++++ OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 5 ++++- bin/OpenSimDefaults.ini | 5 +++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 6666328271..96e6863727 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -79,6 +79,14 @@ namespace OpenSim.Region.Framework.Scenes /// public bool m_physicalPrim; + /// + /// Controls whether prims can be collided with. + /// + /// + /// If this is set to false then prims cannot be subject to physics either. + /// + public bool CollidablePrims { get; private set; } + public float m_maxNonphys = 256; public float m_maxPhys = 10; public bool m_clampPrimSize; @@ -651,6 +659,7 @@ namespace OpenSim.Region.Framework.Scenes m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); m_physicalPrim = startupConfig.GetBoolean("physical_prim", true); + CollidablePrims = startupConfig.GetBoolean("collidable_prim", true); m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); if (RegionInfo.NonphysPrimMax > 0) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index b29ecc6465..8fd136d373 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1473,6 +1473,9 @@ namespace OpenSim.Region.Framework.Scenes /// public void ApplyPhysics(uint rootObjectFlags, bool VolumeDetectActive) { + if (!ParentGroup.Scene.CollidablePrims) + return; + // m_log.DebugFormat( // "[SCENE OBJECT PART]: Applying physics to {0} {1}, m_physicalPrim {2}", // Name, LocalId, UUID, m_physicalPrim); @@ -4318,7 +4321,7 @@ namespace OpenSim.Region.Framework.Scenes if (ParentGroup.Scene == null) return; - if (PhysActor == null) + if (ParentGroup.Scene.CollidablePrims && PhysActor == null) { // It's not phantom anymore. So make sure the physics engine get's knowledge of it PhysActor = ParentGroup.Scene.PhysicsScene.AddPrimShape( diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 972efe4ae2..3e7f8a626f 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -181,6 +181,11 @@ ; ## PHYSICS ; ## + ; If true then prims can be collided with by avatars, other prims, etc. + ; If false then all prims are phantom, no matter whether their phantom flag is checked or unchecked. + ; Also, no prims are subject to physics. + collidable_prim = true + ; If true then prims can be made subject to physics (gravity, pushing, etc.). ; If false then physics flag can be set but it is not honoured. However, prims are still solid for the purposes of collision direction physical_prim = true From f7dbdba447cf91b03749c09d24709b03bc9f7831 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 22 Dec 2011 19:52:09 +0000 Subject: [PATCH 2/8] Remove unused m_physicalPrim parameter from SOG.ApplyPhysics() --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 1 - OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index a3e4b4638c..1e2901b835 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -333,7 +333,6 @@ namespace OpenSim.Region.Framework.Scenes if (rot != null) sceneObject.UpdateGroupRotationR((Quaternion)rot); - //group.ApplyPhysics(m_physicalPrim); if (sceneObject.RootPart.PhysActor != null && sceneObject.RootPart.PhysActor.IsPhysical && vel != Vector3.Zero) { sceneObject.RootPart.ApplyImpulse((vel * sceneObject.GetMass()), false); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index abea7883da..0585477dcc 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -669,7 +669,7 @@ namespace OpenSim.Region.Framework.Scenes //m_log.DebugFormat("[SCENE]: Given local id {0} to part {1}, linknum {2}, parent {3} {4}", part.LocalId, part.UUID, part.LinkNum, part.ParentID, part.ParentUUID); } - ApplyPhysics(m_scene.m_physicalPrim); + ApplyPhysics(); // Don't trigger the update here - otherwise some client issues occur when multiple updates are scheduled // for the same object with very different properties. The caller must schedule the update. @@ -1239,8 +1239,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// Apply physics to this group /// - /// - public void ApplyPhysics(bool m_physicalPrim) + public void ApplyPhysics() { // Apply physics to the root prim m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive); From 7ccd8f8f1d8accb0c5f67e9e3bc9a43fbbfd93e2 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 22 Dec 2011 19:57:50 +0000 Subject: [PATCH 3/8] rename Scene.m_physicalPrim to PhysicalPrims since its public and access external as a property --- OpenSim/Region/Framework/Scenes/Scene.cs | 4 ++-- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 96e6863727..b4972d60ba 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -77,7 +77,7 @@ namespace OpenSim.Region.Framework.Scenes /// Controls whether physics can be applied to prims. Even if false, prims still have entries in a /// PhysicsScene in order to perform collision detection /// - public bool m_physicalPrim; + public bool PhysicalPrims { get; private set; } /// /// Controls whether prims can be collided with. @@ -658,7 +658,7 @@ namespace OpenSim.Region.Framework.Scenes //Animation states m_useFlySlow = startupConfig.GetBoolean("enableflyslow", false); - m_physicalPrim = startupConfig.GetBoolean("physical_prim", true); + PhysicalPrims = startupConfig.GetBoolean("physical_prim", true); CollidablePrims = startupConfig.GetBoolean("collidable_prim", true); m_maxNonphys = startupConfig.GetFloat("NonPhysicalPrimMax", m_maxNonphys); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 8fd136d373..aea47e6407 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1742,7 +1742,7 @@ namespace OpenSim.Region.Framework.Scenes /// public void DoPhysicsPropertyUpdate(bool UsePhysics, bool isNew) { - if (!ParentGroup.Scene.m_physicalPrim && UsePhysics) + if (!ParentGroup.Scene.PhysicalPrims && UsePhysics) return; if (IsJoint()) From 790ca65c84b8597b20f63ba48556c0fb2141a4f0 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Thu, 22 Dec 2011 20:22:15 +0000 Subject: [PATCH 4/8] Align default ODE_STEPSIZE with that already used through OpenSimDefaults.ini --- OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index 04ba7380a0..2194ff0fe0 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs @@ -110,7 +110,7 @@ namespace OpenSim.Region.Physics.OdePlugin private const uint m_regionWidth = Constants.RegionSize; private const uint m_regionHeight = Constants.RegionSize; - private float ODE_STEPSIZE = 0.020f; + private float ODE_STEPSIZE = 0.0178f; private float metersInSpace = 29.9f; private float m_timeDilation = 1.0f; @@ -456,7 +456,7 @@ namespace OpenSim.Region.Physics.OdePlugin mAvatarObjectContactFriction = physicsconfig.GetFloat("m_avatarobjectcontact_friction", 75f); mAvatarObjectContactBounce = physicsconfig.GetFloat("m_avatarobjectcontact_bounce", 0.1f); - ODE_STEPSIZE = physicsconfig.GetFloat("world_stepsize", 0.020f); + ODE_STEPSIZE = physicsconfig.GetFloat("world_stepsize", ODE_STEPSIZE); m_physicsiterations = physicsconfig.GetInt("world_internal_steps_without_collisions", 10); avDensity = physicsconfig.GetFloat("av_density", 80f); From 6b08c051a33d97d94d9c68d287926939f1a5d6b2 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Thu, 22 Dec 2011 15:31:51 -0800 Subject: [PATCH 5/8] Enables processing of hypergrid links through simiangrid services. Thanks otakup0pe --- .../SimianGrid/SimianGridServiceConnector.cs | 77 +++++++++++++------ 1 file changed, 54 insertions(+), 23 deletions(-) diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index 918544f1f6..67a65ff623 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs @@ -341,26 +341,54 @@ namespace OpenSim.Services.Connectors.SimianGrid public List GetHyperlinks(UUID scopeID) { - // Hypergrid/linked regions are not supported - return new List(); + List foundRegions = new List(); + + NameValueCollection requestArgs = new NameValueCollection + { + { "RequestMethod", "GetScenes" }, + { "HyperGrid", "true" }, + { "Enabled", "1" } + }; + + OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); + if (response["Success"].AsBoolean()) + { + // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] found regions with name {0}",name); + + OSDArray array = response["Scenes"] as OSDArray; + if (array != null) + { + for (int i = 0; i < array.Count; i++) + { + GridRegion region = ResponseToGridRegion(array[i] as OSDMap); + if (region != null) + foundRegions.Add(region); + } + } + } + + return foundRegions; } - + public int GetRegionFlags(UUID scopeID, UUID regionID) { - const int REGION_ONLINE = 4; - NameValueCollection requestArgs = new NameValueCollection { { "RequestMethod", "GetScene" }, { "SceneID", regionID.ToString() } }; - // m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request region flags for {0}",regionID.ToString()); + m_log.DebugFormat("[SIMIAN GRID CONNECTOR] request region flags for {0}",regionID.ToString()); OSDMap response = WebUtil.PostToService(m_ServerURI, requestArgs); if (response["Success"].AsBoolean()) { - return response["Enabled"].AsBoolean() ? REGION_ONLINE : 0; + OSDMap extraData = response["ExtraData"] as OSDMap; + int enabled = response["Enabled"].AsBoolean() ? (int) OpenSim.Data.RegionFlags.RegionOnline : 0; + int hypergrid = extraData["HyperGrid"].AsBoolean() ? (int) OpenSim.Data.RegionFlags.Hyperlink : 0; + int flags = enabled | hypergrid; + m_log.DebugFormat("[SGGC] enabled - {0} hg - {1} flags - {2}", enabled, hypergrid, flags); + return flags; } else { @@ -411,24 +439,27 @@ namespace OpenSim.Services.Connectors.SimianGrid Vector3d minPosition = response["MinPosition"].AsVector3d(); region.RegionLocX = (int)minPosition.X; region.RegionLocY = (int)minPosition.Y; + + if ( ! extraData["HyperGrid"] ) { + Uri httpAddress = response["Address"].AsUri(); + region.ExternalHostName = httpAddress.Host; + region.HttpPort = (uint)httpAddress.Port; - Uri httpAddress = response["Address"].AsUri(); - region.ExternalHostName = httpAddress.Host; - region.HttpPort = (uint)httpAddress.Port; + IPAddress internalAddress; + IPAddress.TryParse(extraData["InternalAddress"].AsString(), out internalAddress); + if (internalAddress == null) + internalAddress = IPAddress.Any; - region.ServerURI = extraData["ServerURI"].AsString(); - - IPAddress internalAddress; - IPAddress.TryParse(extraData["InternalAddress"].AsString(), out internalAddress); - if (internalAddress == null) - internalAddress = IPAddress.Any; - - region.InternalEndPoint = new IPEndPoint(internalAddress, extraData["InternalPort"].AsInteger()); - region.TerrainImage = extraData["MapTexture"].AsUUID(); - region.Access = (byte)extraData["Access"].AsInteger(); - region.RegionSecret = extraData["RegionSecret"].AsString(); - region.EstateOwner = extraData["EstateOwner"].AsUUID(); - region.Token = extraData["Token"].AsString(); + region.InternalEndPoint = new IPEndPoint(internalAddress, extraData["InternalPort"].AsInteger()); + region.TerrainImage = extraData["MapTexture"].AsUUID(); + region.Access = (byte)extraData["Access"].AsInteger(); + region.RegionSecret = extraData["RegionSecret"].AsString(); + region.EstateOwner = extraData["EstateOwner"].AsUUID(); + region.Token = extraData["Token"].AsString(); + region.ServerURI = extraData["ServerURI"].AsString(); + } else { + region.ServerURI = response["Address"]; + } return region; } From f394cb2e8f1605809dbf3d5503b9ae00dc1f5180 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Thu, 22 Dec 2011 16:21:32 -0800 Subject: [PATCH 6/8] fix the UsesPhysics flag to reference the physics flag rather than the temponrez flag --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 0585477dcc..886076499b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -210,7 +210,7 @@ namespace OpenSim.Region.Framework.Scenes /// public bool UsesPhysics { - get { return (RootPart.Flags & PrimFlags.TemporaryOnRez) != 0; } + get { return (RootPart.Flags & PrimFlags.Physics) != 0; } } /// From 456c89a7a30c5c2ec2e228beb717b9c611106364 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Thu, 22 Dec 2011 16:59:51 -0800 Subject: [PATCH 7/8] Fixes some problems with objects that attempt to cross a region boundary into a region that does not exist. This is particularly problematic for physical objects where the velocity continues to move them out of the region causing an infinite number of failed region crossings. The patch forces an object that fails a crossing to be non-physical and moves it back into the starting region. --- .../EntityTransfer/EntityTransferModule.cs | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index b9d5d325ab..098e5cb747 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1705,6 +1705,30 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer uint x = 0, y = 0; Utils.LongToUInts(newRegionHandle, out x, out y); GridRegion destination = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y); + + if (destination == null || !CrossPrimGroupIntoNewRegion(destination, grp, silent)) + { + m_log.InfoFormat("[ENTITY TRANSFER MODULE] cross region transfer failed for object {0}",grp.UUID); + + // We are going to move the object back to the old position so long as the old position + // is in the region + oldGroupPosition.X = Util.Clamp(oldGroupPosition.X,1.0f,(float)Constants.RegionSize-1); + oldGroupPosition.Y = Util.Clamp(oldGroupPosition.Y,1.0f,(float)Constants.RegionSize-1); + oldGroupPosition.Z = Util.Clamp(oldGroupPosition.Z,1.0f,4096.0f); + + grp.RootPart.GroupPosition = oldGroupPosition; + + // Need to turn off the physics flags, otherwise the object will continue to attempt to + // move out of the region creating an infinite loop of failed attempts to cross + grp.UpdatePrimFlags(grp.RootPart.LocalId,false,grp.IsTemporary,grp.IsPhantom,false); + + grp.ScheduleGroupForFullUpdate(); + } + + + + + if (destination != null && !CrossPrimGroupIntoNewRegion(destination, grp, silent)) { grp.RootPart.GroupPosition = oldGroupPosition; From c6ce464dbc64dc24878a8032412e82b02b9314f6 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Fri, 23 Dec 2011 10:13:32 -0800 Subject: [PATCH 8/8] remove the old region crossing handler --- .../Framework/EntityTransfer/EntityTransferModule.cs | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 098e5cb747..cbef6ce47b 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1724,16 +1724,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer grp.ScheduleGroupForFullUpdate(); } - - - - - - if (destination != null && !CrossPrimGroupIntoNewRegion(destination, grp, silent)) - { - grp.RootPart.GroupPosition = oldGroupPosition; - grp.ScheduleGroupForFullUpdate(); - } }