aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs4
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs12
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs78
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs4
5 files changed, 60 insertions, 40 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index bc0ccb3..3c8dc0a 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -491,7 +491,7 @@ namespace OpenSim.Region.Environment.Scenes
491 new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, 491 new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
492 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics); 492 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics);
493 493
494 rootPart.doPhysicsPropertyUpdate(UsePhysics); 494 rootPart.doPhysicsPropertyUpdate(UsePhysics, true);
495 495
496 } 496 }
497 rootPart.ScheduleFullUpdate(); 497 rootPart.ScheduleFullUpdate();
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index dcba9bd..405f2e3 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -604,7 +604,7 @@ namespace OpenSim.Region.Environment.Scenes
604 new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), 604 new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
605 new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, 605 new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
606 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics); 606 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics);
607 rootPart.doPhysicsPropertyUpdate(UsePhysics); 607 rootPart.doPhysicsPropertyUpdate(UsePhysics, true);
608 } 608 }
609 MainLog.Instance.Verbose("Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)"); 609 MainLog.Instance.Verbose("Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)");
610 } 610 }
@@ -657,7 +657,7 @@ namespace OpenSim.Region.Environment.Scenes
657 new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z), 657 new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z),
658 new Quaternion(), UsePhysics); 658 new Quaternion(), UsePhysics);
659 // subscribe to physics events. 659 // subscribe to physics events.
660 rootPart.doPhysicsPropertyUpdate(UsePhysics); 660 rootPart.doPhysicsPropertyUpdate(UsePhysics, true);
661 661
662 } 662 }
663 } 663 }
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 38962c1..efee81b 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -150,6 +150,7 @@ namespace OpenSim.Region.Environment.Scenes
150 m_rootPart.PhysActor.Position = 150 m_rootPart.PhysActor.Position =
151 new PhysicsVector(m_rootPart.GroupPosition.X, m_rootPart.GroupPosition.Y, 151 new PhysicsVector(m_rootPart.GroupPosition.X, m_rootPart.GroupPosition.Y,
152 m_rootPart.GroupPosition.Z); 152 m_rootPart.GroupPosition.Z);
153 m_scene.PhysScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
153 } 154 }
154 } 155 }
155 } 156 }
@@ -480,7 +481,7 @@ namespace OpenSim.Region.Environment.Scenes
480 new Quaternion(dupe.RootPart.RotationOffset.W, dupe.RootPart.RotationOffset.X, 481 new Quaternion(dupe.RootPart.RotationOffset.W, dupe.RootPart.RotationOffset.X,
481 dupe.RootPart.RotationOffset.Y, dupe.RootPart.RotationOffset.Z), 482 dupe.RootPart.RotationOffset.Y, dupe.RootPart.RotationOffset.Z),
482 dupe.RootPart.PhysActor.IsPhysical); 483 dupe.RootPart.PhysActor.IsPhysical);
483 dupe.RootPart.doPhysicsPropertyUpdate(dupe.RootPart.PhysActor.IsPhysical); 484 dupe.RootPart.doPhysicsPropertyUpdate(dupe.RootPart.PhysActor.IsPhysical, true);
484 485
485 } 486 }
486 // Now we've made a copy that replaces this one, we need to 487 // Now we've made a copy that replaces this one, we need to
@@ -784,6 +785,7 @@ namespace OpenSim.Region.Environment.Scenes
784 if (linkPart.PhysActor != null) 785 if (linkPart.PhysActor != null)
785 { 786 {
786 m_scene.PhysScene.RemovePrim(linkPart.PhysActor); 787 m_scene.PhysScene.RemovePrim(linkPart.PhysActor);
788
787 linkPart.PhysActor = null; 789 linkPart.PhysActor = null;
788 } 790 }
789 791
@@ -861,7 +863,7 @@ namespace OpenSim.Region.Environment.Scenes
861 new Quaternion(linkPart.RotationOffset.W, linkPart.RotationOffset.X, 863 new Quaternion(linkPart.RotationOffset.W, linkPart.RotationOffset.X,
862 linkPart.RotationOffset.Y, linkPart.RotationOffset.Z), 864 linkPart.RotationOffset.Y, linkPart.RotationOffset.Z),
863 m_rootPart.PhysActor.IsPhysical); 865 m_rootPart.PhysActor.IsPhysical);
864 m_rootPart.doPhysicsPropertyUpdate(m_rootPart.PhysActor.IsPhysical); 866 m_rootPart.doPhysicsPropertyUpdate(m_rootPart.PhysActor.IsPhysical, true);
865 867
866 } 868 }
867 869
@@ -1170,7 +1172,7 @@ namespace OpenSim.Region.Environment.Scenes
1170 m_rootPart.RotationOffset.Y, m_rootPart.RotationOffset.Z), 1172 m_rootPart.RotationOffset.Y, m_rootPart.RotationOffset.Z),
1171 m_rootPart.PhysActor.IsPhysical); 1173 m_rootPart.PhysActor.IsPhysical);
1172 bool UsePhysics = ((m_rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0); 1174 bool UsePhysics = ((m_rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0);
1173 m_rootPart.doPhysicsPropertyUpdate(UsePhysics); 1175 m_rootPart.doPhysicsPropertyUpdate(UsePhysics, true);
1174 1176
1175 } 1177 }
1176 } 1178 }
@@ -1196,6 +1198,7 @@ namespace OpenSim.Region.Environment.Scenes
1196 { 1198 {
1197 m_rootPart.PhysActor.Size = 1199 m_rootPart.PhysActor.Size =
1198 new PhysicsVector(m_rootPart.Scale.X, m_rootPart.Scale.Y, m_rootPart.Scale.Z); 1200 new PhysicsVector(m_rootPart.Scale.X, m_rootPart.Scale.Y, m_rootPart.Scale.Z);
1201 m_scene.PhysScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
1199 } 1202 }
1200 } 1203 }
1201 } 1204 }
@@ -1286,6 +1289,7 @@ namespace OpenSim.Region.Environment.Scenes
1286 m_rootPart.PhysActor.Orientation = 1289 m_rootPart.PhysActor.Orientation =
1287 new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y, 1290 new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y,
1288 m_rootPart.RotationOffset.Z); 1291 m_rootPart.RotationOffset.Z);
1292 m_scene.PhysScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
1289 } 1293 }
1290 ScheduleGroupForTerseUpdate(); 1294 ScheduleGroupForTerseUpdate();
1291 } 1295 }
@@ -1303,6 +1307,7 @@ namespace OpenSim.Region.Environment.Scenes
1303 m_rootPart.PhysActor.Orientation = 1307 m_rootPart.PhysActor.Orientation =
1304 new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y, 1308 new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y,
1305 m_rootPart.RotationOffset.Z); 1309 m_rootPart.RotationOffset.Z);
1310 m_scene.PhysScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
1306 } 1311 }
1307 AbsolutePosition = pos; 1312 AbsolutePosition = pos;
1308 ScheduleGroupForTerseUpdate(); 1313 ScheduleGroupForTerseUpdate();
@@ -1346,6 +1351,7 @@ namespace OpenSim.Region.Environment.Scenes
1346 m_rootPart.PhysActor.Orientation = 1351 m_rootPart.PhysActor.Orientation =
1347 new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y, 1352 new Quaternion(m_rootPart.RotationOffset.W, m_rootPart.RotationOffset.X, m_rootPart.RotationOffset.Y,
1348 m_rootPart.RotationOffset.Z); 1353 m_rootPart.RotationOffset.Z);
1354 m_scene.PhysScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
1349 } 1355 }
1350 1356
1351 foreach (SceneObjectPart prim in m_parts.Values) 1357 foreach (SceneObjectPart prim in m_parts.Values)
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index 76fe4b6..7bab3b6 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -170,9 +170,10 @@ namespace OpenSim.Region.Environment.Scenes
170 { 170 {
171 try 171 try
172 { 172 {
173 //lock (m_scene.SyncRoot) 173 //lock (m_parentGroup.m_scene.SyncRoot)
174 //{ 174 //{
175 PhysActor.Position = new PhysicsVector(value.X, value.Y, value.Z); 175 PhysActor.Position = new PhysicsVector(value.X, value.Y, value.Z);
176 m_parentGroup.m_scene.PhysScene.AddPhysicsActorTaint(PhysActor);
176 //} 177 //}
177 } 178 }
178 catch (Exception e) 179 catch (Exception e)
@@ -225,6 +226,7 @@ namespace OpenSim.Region.Environment.Scenes
225 //lock (m_scene.SyncRoot) 226 //lock (m_scene.SyncRoot)
226 //{ 227 //{
227 PhysActor.Orientation = new Quaternion(value.W, value.X, value.Y, value.Z); 228 PhysActor.Orientation = new Quaternion(value.W, value.X, value.Y, value.Z);
229 m_parentGroup.m_scene.PhysScene.AddPhysicsActorTaint(PhysActor);
228 //} 230 //}
229 } 231 }
230 catch (Exception ex) 232 catch (Exception ex)
@@ -502,7 +504,7 @@ namespace OpenSim.Region.Environment.Scenes
502 RotationOffset = rotation; 504 RotationOffset = rotation;
503 ObjectFlags = flags; 505 ObjectFlags = flags;
504 bool UsePhysics = ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0); 506 bool UsePhysics = ((ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0);
505 doPhysicsPropertyUpdate(UsePhysics); 507 doPhysicsPropertyUpdate(UsePhysics, true);
506 ScheduleFullUpdate(); 508 ScheduleFullUpdate();
507 } 509 }
508 510
@@ -518,7 +520,7 @@ namespace OpenSim.Region.Environment.Scenes
518 XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart)); 520 XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart));
519 SceneObjectPart newobject = (SceneObjectPart) serializer.Deserialize(xmlReader); 521 SceneObjectPart newobject = (SceneObjectPart) serializer.Deserialize(xmlReader);
520 bool UsePhysics = ((newobject.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0); 522 bool UsePhysics = ((newobject.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0);
521 newobject.doPhysicsPropertyUpdate(UsePhysics); 523 newobject.doPhysicsPropertyUpdate(UsePhysics, true);
522 524
523 return newobject; 525 return newobject;
524 } 526 }
@@ -586,7 +588,7 @@ namespace OpenSim.Region.Environment.Scenes
586 Array.Copy(Shape.ExtraParams, extraP, extraP.Length); 588 Array.Copy(Shape.ExtraParams, extraP, extraP.Length);
587 dupe.Shape.ExtraParams = extraP; 589 dupe.Shape.ExtraParams = extraP;
588 bool UsePhysics = ((dupe.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0); 590 bool UsePhysics = ((dupe.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) != 0);
589 dupe.doPhysicsPropertyUpdate(UsePhysics); 591 dupe.doPhysicsPropertyUpdate(UsePhysics, true);
590 592
591 return dupe; 593 return dupe;
592 } 594 }
@@ -852,7 +854,7 @@ namespace OpenSim.Region.Environment.Scenes
852 AddFlag(LLObject.ObjectFlags.Physics); 854 AddFlag(LLObject.ObjectFlags.Physics);
853 if (!wasUsingPhysics) 855 if (!wasUsingPhysics)
854 { 856 {
855 doPhysicsPropertyUpdate(UsePhysics); 857 doPhysicsPropertyUpdate(UsePhysics,false);
856 } 858 }
857 859
858 } 860 }
@@ -861,7 +863,7 @@ namespace OpenSim.Region.Environment.Scenes
861 RemFlag(LLObject.ObjectFlags.Physics); 863 RemFlag(LLObject.ObjectFlags.Physics);
862 if (wasUsingPhysics) 864 if (wasUsingPhysics)
863 { 865 {
864 doPhysicsPropertyUpdate(UsePhysics); 866 doPhysicsPropertyUpdate(UsePhysics, false);
865 } 867 }
866 } 868 }
867 869
@@ -892,12 +894,12 @@ namespace OpenSim.Region.Environment.Scenes
892 new PhysicsVector(Scale.X, Scale.Y, Scale.Z), 894 new PhysicsVector(Scale.X, Scale.Y, Scale.Z),
893 new Quaternion(RotationOffset.W, RotationOffset.X, 895 new Quaternion(RotationOffset.W, RotationOffset.X,
894 RotationOffset.Y, RotationOffset.Z), UsePhysics); 896 RotationOffset.Y, RotationOffset.Z), UsePhysics);
895 doPhysicsPropertyUpdate(UsePhysics); 897 doPhysicsPropertyUpdate(UsePhysics, true);
896 } 898 }
897 else 899 else
898 { 900 {
899 PhysActor.IsPhysical = UsePhysics; 901 PhysActor.IsPhysical = UsePhysics;
900 doPhysicsPropertyUpdate(UsePhysics); 902 doPhysicsPropertyUpdate(UsePhysics,false);
901 } 903 }
902 } 904 }
903 905
@@ -912,36 +914,45 @@ namespace OpenSim.Region.Environment.Scenes
912// System.Console.WriteLine("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString()); 914// System.Console.WriteLine("Update: PHY:" + UsePhysics.ToString() + ", T:" + IsTemporary.ToString() + ", PHA:" + IsPhantom.ToString() + " S:" + CastsShadows.ToString());
913 ScheduleFullUpdate(); 915 ScheduleFullUpdate();
914 } 916 }
915 public void doPhysicsPropertyUpdate(bool UsePhysics) 917 public void doPhysicsPropertyUpdate(bool UsePhysics, bool isNew)
916 { 918 {
917 919
918 if (PhysActor != null) 920 if (PhysActor != null)
919 { 921 {
920 if (PhysActor.IsPhysical) 922 if (UsePhysics != PhysActor.IsPhysical || isNew)
921 { 923 {
922 PhysActor.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate; 924
923 PhysActor.OnOutOfBounds -= PhysicsOutOfBounds; 925 if (PhysActor.IsPhysical)
924 } 926 {
925 m_parentGroup.m_scene.PhysScene.RemovePrim(PhysActor); 927 PhysActor.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate;
926 /// that's not wholesome. Had to make m_scene public 928 PhysActor.OnOutOfBounds -= PhysicsOutOfBounds;
927 PhysActor = null; 929 }
928 930
929 if ((ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) 931 PhysActor.IsPhysical = UsePhysics;
930 { 932 // If we're not what we're supposed to be in the physics scene, recreate ourselves.
931 PhysActor = m_parentGroup.m_scene.PhysScene.AddPrimShape( 933 //m_parentGroup.m_scene.PhysScene.RemovePrim(PhysActor);
932 Name, 934 /// that's not wholesome. Had to make m_scene public
933 Shape, 935 //PhysActor = null;
934 new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, 936
935 AbsolutePosition.Z), 937
936 new PhysicsVector(Scale.X, Scale.Y, Scale.Z), 938 if ((ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0)
937 new Quaternion(RotationOffset.W, RotationOffset.X,
938 RotationOffset.Y, RotationOffset.Z), UsePhysics);
939 if (UsePhysics)
940 { 939 {
941 PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate; 940 //PhysActor = m_parentGroup.m_scene.PhysScene.AddPrimShape(
942 PhysActor.OnOutOfBounds += PhysicsOutOfBounds; 941 //Name,
942 //Shape,
943 //new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y,
944 //AbsolutePosition.Z),
945 //new PhysicsVector(Scale.X, Scale.Y, Scale.Z),
946 //new Quaternion(RotationOffset.W, RotationOffset.X,
947 //RotationOffset.Y, RotationOffset.Z), UsePhysics);
948 if (UsePhysics)
949 {
950 PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate;
951 PhysActor.OnOutOfBounds += PhysicsOutOfBounds;
952 }
943 } 953 }
944 } 954 }
955 m_parentGroup.m_scene.PhysScene.AddPhysicsActorTaint(PhysActor);
945 } 956 }
946 } 957 }
947 958
@@ -1195,8 +1206,11 @@ namespace OpenSim.Region.Environment.Scenes
1195 public void PhysicsOutOfBounds(PhysicsVector pos) 1206 public void PhysicsOutOfBounds(PhysicsVector pos)
1196 { 1207 {
1197 OpenSim.Framework.Console.MainLog.Instance.Verbose("PHYSICS", "Physical Object went out of bounds."); 1208 OpenSim.Framework.Console.MainLog.Instance.Verbose("PHYSICS", "Physical Object went out of bounds.");
1198 doPhysicsPropertyUpdate(false); 1209 RemFlag(LLObject.ObjectFlags.Physics);
1199 ScheduleFullUpdate(); 1210 doPhysicsPropertyUpdate(false,true);
1211 m_parentGroup.m_scene.PhysScene.AddPhysicsActorTaint(PhysActor);
1212
1213
1200 } 1214 }
1201 1215
1202 1216
diff --git a/OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs b/OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs
index 3b5fc57..5c460be 100644
--- a/OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs
@@ -55,7 +55,7 @@ namespace OpenSim.Region.Environment.Scenes
55 new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), 55 new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
56 new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, 56 new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
57 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics); 57 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics);
58 rootPart.doPhysicsPropertyUpdate(UsePhysics); 58 rootPart.doPhysicsPropertyUpdate(UsePhysics, true);
59 59
60 } 60 }
61 primCount++; 61 primCount++;
@@ -125,7 +125,7 @@ namespace OpenSim.Region.Environment.Scenes
125 new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), 125 new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
126 new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, 126 new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
127 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics); 127 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics);
128 rootPart.doPhysicsPropertyUpdate(UsePhysics); 128 rootPart.doPhysicsPropertyUpdate(UsePhysics, true);
129 } 129 }
130 } 130 }
131 131