aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
diff options
context:
space:
mode:
authorTeravus Ovares2007-11-20 04:38:08 +0000
committerTeravus Ovares2007-11-20 04:38:08 +0000
commit5a71d03b7ac1de0b599f651c62bf1e33a3d1745d (patch)
treedd85b6f7d5fb5069fd281a70dd79e6daf267a1bd /OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
parentPOS physics. tweaking stair-climbing which broke with my last change (diff)
downloadopensim-SC_OLD-5a71d03b7ac1de0b599f651c62bf1e33a3d1745d.zip
opensim-SC_OLD-5a71d03b7ac1de0b599f651c62bf1e33a3d1745d.tar.gz
opensim-SC_OLD-5a71d03b7ac1de0b599f651c62bf1e33a3d1745d.tar.bz2
opensim-SC_OLD-5a71d03b7ac1de0b599f651c62bf1e33a3d1745d.tar.xz
*Huge* structural changes in ODE/OdePrim to get all of the calls in threadlocked code. ODEPrim was almost completely re-written.
Copy/Space test needed.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectPart.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs78
1 files changed, 46 insertions, 32 deletions
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