aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-04-21 01:43:09 +0100
committerJustin Clark-Casey (justincc)2012-04-21 01:43:09 +0100
commit9ac48b2aff2ddd00821b7e6ecd71ce134f7a0f25 (patch)
tree1509d9105df5a05adf475ce93c35a885420c0be4 /OpenSim/Region/Framework/Scenes
parentAdd test for correct physics status on linking two physics objects (diff)
downloadopensim-SC_OLD-9ac48b2aff2ddd00821b7e6ecd71ce134f7a0f25.zip
opensim-SC_OLD-9ac48b2aff2ddd00821b7e6ecd71ce134f7a0f25.tar.gz
opensim-SC_OLD-9ac48b2aff2ddd00821b7e6ecd71ce134f7a0f25.tar.bz2
opensim-SC_OLD-9ac48b2aff2ddd00821b7e6ecd71ce134f7a0f25.tar.xz
Fix a bug where linking a non-physical prim with a physical prim as root would make the non-physical prim phantom rather than part of the physics object.
On region restart, the whole object would become physical as expected. Observed behaviour from elsewhere is that all prims in a new linkset should take on the status of the root prim. Add regression test for this behaviour.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs3
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs19
2 files changed, 22 insertions, 0 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 8e786c1..49a3485 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -2010,6 +2010,7 @@ namespace OpenSim.Region.Framework.Scenes
2010 linkPart.CreateSelected = true; 2010 linkPart.CreateSelected = true;
2011 2011
2012 linkPart.LinkNum = linkNum++; 2012 linkPart.LinkNum = linkNum++;
2013 linkPart.UpdatePrimFlags(UsesPhysics, IsTemporary, IsPhantom, IsVolumeDetect);
2013 2014
2014 SceneObjectPart[] ogParts = objectGroup.Parts; 2015 SceneObjectPart[] ogParts = objectGroup.Parts;
2015 Array.Sort(ogParts, delegate(SceneObjectPart a, SceneObjectPart b) 2016 Array.Sort(ogParts, delegate(SceneObjectPart a, SceneObjectPart b)
@@ -2220,6 +2221,8 @@ namespace OpenSim.Region.Framework.Scenes
2220 oldRot = part.RotationOffset; 2221 oldRot = part.RotationOffset;
2221 Quaternion newRot = Quaternion.Inverse(parentRot) * oldRot; 2222 Quaternion newRot = Quaternion.Inverse(parentRot) * oldRot;
2222 part.RotationOffset = newRot; 2223 part.RotationOffset = newRot;
2224
2225 part.UpdatePrimFlags(UsesPhysics, IsTemporary, IsPhantom, IsVolumeDetect);
2223 } 2226 }
2224 2227
2225 /// <summary> 2228 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
index 6270ac1..91f4a34 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectStatusTests.cs
@@ -112,5 +112,24 @@ namespace OpenSim.Region.Framework.Scenes.Tests
112 Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.Physics)); 112 Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.Physics));
113 Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.Physics)); 113 Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.Physics));
114 } 114 }
115
116 /// <summary>
117 /// Test that linking results in the correct physical status for all linkees.
118 /// </summary>
119 [Test]
120 public void TestLinkPhysicsRootPhysicalOnly()
121 {
122 TestHelpers.InMethod();
123
124 m_scene.AddSceneObject(m_so1);
125 m_scene.AddSceneObject(m_so2);
126
127 m_so1.ScriptSetPhysicsStatus(true);
128
129 m_scene.LinkObjects(m_ownerId, m_so1.LocalId, new List<uint>() { m_so2.LocalId });
130
131 Assert.That(m_so1.RootPart.Flags, Is.EqualTo(PrimFlags.Physics));
132 Assert.That(m_so1.Parts[1].Flags, Is.EqualTo(PrimFlags.Physics));
133 }
115 } 134 }
116} \ No newline at end of file 135} \ No newline at end of file