aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorTeravus Ovares2008-02-12 07:32:32 +0000
committerTeravus Ovares2008-02-12 07:32:32 +0000
commite5ede36f0c8974dc81d1755d16513641aff535c2 (patch)
treeea29d39f83ceb72b61d98184aab08c90ee3d7b10 /OpenSim/Region
parent* A bunch of updates to make things more smooth. (diff)
downloadopensim-SC_OLD-e5ede36f0c8974dc81d1755d16513641aff535c2.zip
opensim-SC_OLD-e5ede36f0c8974dc81d1755d16513641aff535c2.tar.gz
opensim-SC_OLD-e5ede36f0c8974dc81d1755d16513641aff535c2.tar.bz2
opensim-SC_OLD-e5ede36f0c8974dc81d1755d16513641aff535c2.tar.xz
* Physical prim cross borders and continue from where the left off on the other side now, assuming the region on the other side has physical prim enabled.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs22
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs25
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs4
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs44
5 files changed, 78 insertions, 19 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index b797cc3..ba2a2cf 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -745,7 +745,7 @@ namespace OpenSim.Region.Environment.Scenes
745 } 745 }
746 catch (Exception e) 746 catch (Exception e)
747 { 747 {
748 m_log.Error("[Scene]: Failed with exception " + e.ToString()); 748 m_log.Error("[Scene]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName);
749 } 749 }
750 finally 750 finally
751 { 751 {
@@ -1230,32 +1230,32 @@ namespace OpenSim.Region.Environment.Scenes
1230 int thisx = (int)RegionInfo.RegionLocX; 1230 int thisx = (int)RegionInfo.RegionLocX;
1231 int thisy = (int)RegionInfo.RegionLocY; 1231 int thisy = (int)RegionInfo.RegionLocY;
1232 ulong newRegionHandle = 0; 1232 ulong newRegionHandle = 0;
1233 LLVector3 pos = grp.AbsolutePosition; 1233 LLVector3 pos = position;
1234 1234
1235 if (position.X > 255.6f) 1235 if (position.X > 257f)
1236 { 1236 {
1237 pos.X = ((pos.X - 256) + 10); 1237 pos.X = ((pos.X - 256));
1238 1238
1239 newRegionHandle = Util.UIntsToLong((uint)((thisx + 1) * 256), (uint)(thisy * 256)); 1239 newRegionHandle = Util.UIntsToLong((uint)((thisx + 1) * 256), (uint)(thisy * 256));
1240 1240
1241 // x + 1 1241 // x + 1
1242 } 1242 }
1243 else if (position.X < 0.4f) 1243 else if (position.X < -1f)
1244 { 1244 {
1245 pos.X = ((pos.X + 256) - 10); 1245 pos.X = ((pos.X + 256));
1246 newRegionHandle = Util.UIntsToLong((uint)((thisx - 1) * 256), (uint)(thisy * 256)); 1246 newRegionHandle = Util.UIntsToLong((uint)((thisx - 1) * 256), (uint)(thisy * 256));
1247 // x - 1 1247 // x - 1
1248 } 1248 }
1249 1249
1250 if (position.Y > 255.6f) 1250 if (position.Y > 257f)
1251 { 1251 {
1252 pos.Y = ((pos.Y - 256) + 10); 1252 pos.Y = ((pos.Y - 256));
1253 newRegionHandle = Util.UIntsToLong((uint)(thisx * 256), (uint)((thisy + 1) * 256)); 1253 newRegionHandle = Util.UIntsToLong((uint)(thisx * 256), (uint)((thisy + 1) * 256));
1254 // y + 1 1254 // y + 1
1255 } 1255 }
1256 else if (position.Y < 0.4f) 1256 else if (position.Y < -1f)
1257 { 1257 {
1258 pos.Y = ((pos.Y + 256) - 10); 1258 pos.Y = ((pos.Y + 256));
1259 newRegionHandle = Util.UIntsToLong((uint)(thisx * 256), (uint)((thisy - 1) * 256)); 1259 newRegionHandle = Util.UIntsToLong((uint)(thisx * 256), (uint)((thisy - 1) * 256));
1260 // y - 1 1260 // y - 1
1261 } 1261 }
@@ -1287,7 +1287,7 @@ namespace OpenSim.Region.Environment.Scenes
1287 } 1287 }
1288 public void IncomingInterRegionPrimGroup(ulong regionHandle, LLUUID primID, string objXMLData) 1288 public void IncomingInterRegionPrimGroup(ulong regionHandle, LLUUID primID, string objXMLData)
1289 { 1289 {
1290 m_log.Warn("{[INTERREGION]: OMG! A new prim arrived from a neighbor!.. Kyill eeehht! before it corrupts my entire database! AHHH! I feel so dirty now! yuck! ack! arg!"); 1290 m_log.Warn("{[INTERREGION]: A new prim arrived from a neighbor");
1291 m_sceneXmlLoader.LoadGroupFromXml2String(objXMLData); 1291 m_sceneXmlLoader.LoadGroupFromXml2String(objXMLData);
1292 1292
1293 } 1293 }
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 3b146ea..117bcbc 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -126,7 +126,7 @@ namespace OpenSim.Region.Environment.Scenes
126 set 126 set
127 { 127 {
128 LLVector3 val = value; 128 LLVector3 val = value;
129 if (val.X > 255.6f || val.X < 0.4f || val.Y > 255.6f || val.Y < 0.4f) 129 if (val.X > 257f || val.X < -1f || val.Y > 257f || val.Y < -1f)
130 { 130 {
131 m_scene.CrossPrimGroupIntoNewRegion(val, this); 131 m_scene.CrossPrimGroupIntoNewRegion(val, this);
132 } 132 }
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index 7900900..4f5eefe 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -405,7 +405,19 @@ namespace OpenSim.Region.Environment.Scenes
405 405
406 return m_velocity; 406 return m_velocity;
407 } 407 }
408 set { m_velocity = value; } 408 set {
409
410 m_velocity = value;
411 if (PhysActor != null)
412 {
413 if (PhysActor.IsPhysical)
414 {
415 PhysActor.Velocity = new PhysicsVector(value.X, value.Y, value.Z);
416 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
417 }
418 }
419
420 }
409 } 421 }
410 422
411 public LLVector3 RotationalVelocity 423 public LLVector3 RotationalVelocity
@@ -742,6 +754,7 @@ namespace OpenSim.Region.Environment.Scenes
742 { 754 {
743 XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart)); 755 XmlSerializer serializer = new XmlSerializer(typeof (SceneObjectPart));
744 SceneObjectPart newobject = (SceneObjectPart) serializer.Deserialize(xmlReader); 756 SceneObjectPart newobject = (SceneObjectPart) serializer.Deserialize(xmlReader);
757
745 return newobject; 758 return newobject;
746 } 759 }
747 760
@@ -1776,6 +1789,16 @@ namespace OpenSim.Region.Environment.Scenes
1776 1789
1777 public void PhysicsRequestingTerseUpdate() 1790 public void PhysicsRequestingTerseUpdate()
1778 { 1791 {
1792 if (PhysActor != null)
1793 {
1794 LLVector3 newpos = new LLVector3(PhysActor.Position.GetBytes(), 0);
1795 if (newpos.X > 257f || newpos.X < -1f || newpos.Y > 257f || newpos.Y < -1f)
1796 {
1797 m_parentGroup.AbsolutePosition = newpos;
1798 return;
1799 }
1800
1801 }
1779 ScheduleTerseUpdate(); 1802 ScheduleTerseUpdate();
1780 1803
1781 //SendTerseUpdateToAllClients(); 1804 //SendTerseUpdateToAllClients();
diff --git a/OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs b/OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs
index 6d911f1..4982613 100644
--- a/OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs
@@ -175,6 +175,8 @@ namespace OpenSim.Region.Environment.Scenes
175 public void CreatePrimFromXml(string xmlData) 175 public void CreatePrimFromXml(string xmlData)
176 { 176 {
177 SceneObjectGroup obj = new SceneObjectGroup(xmlData); 177 SceneObjectGroup obj = new SceneObjectGroup(xmlData);
178 LLVector3 receivedVelocity = obj.RootPart.Velocity;
179 //System.Console.WriteLine(obj.RootPart.Velocity.ToString());
178 m_innerScene.AddEntityFromStorage(obj); 180 m_innerScene.AddEntityFromStorage(obj);
179 181
180 SceneObjectPart rootPart = obj.GetChildPart(obj.UUID); 182 SceneObjectPart rootPart = obj.GetChildPart(obj.UUID);
@@ -191,6 +193,8 @@ namespace OpenSim.Region.Environment.Scenes
191 new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, 193 new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
192 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics); 194 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics);
193 rootPart.DoPhysicsPropertyUpdate(UsePhysics, true); 195 rootPart.DoPhysicsPropertyUpdate(UsePhysics, true);
196 rootPart.Velocity = receivedVelocity;
197
194 } 198 }
195 } 199 }
196 200
diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
index 819d823..5cdbb77 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs
@@ -49,6 +49,7 @@ namespace OpenSim.Region.Physics.OdePlugin
49 private Quaternion _orientation; 49 private Quaternion _orientation;
50 private PhysicsVector m_taintposition; 50 private PhysicsVector m_taintposition;
51 private PhysicsVector m_taintsize; 51 private PhysicsVector m_taintsize;
52 private PhysicsVector m_taintVelocity = PhysicsVector.Zero;
52 private Quaternion m_taintrot; 53 private Quaternion m_taintrot;
53 private bool m_taintshape = false; 54 private bool m_taintshape = false;
54 private bool m_taintPhysics = false; 55 private bool m_taintPhysics = false;
@@ -455,8 +456,13 @@ namespace OpenSim.Region.Physics.OdePlugin
455 456
456 if (m_taintdisable) 457 if (m_taintdisable)
457 changedisable(timestep); 458 changedisable(timestep);
459
460 if (m_taintVelocity != PhysicsVector.Zero)
461 changevelocity(timestep);
458 } 462 }
459 463
464
465
460 public void Move(float timestep) 466 public void Move(float timestep)
461 { 467 {
462 if (m_isphysical) 468 if (m_isphysical)
@@ -743,7 +749,18 @@ namespace OpenSim.Region.Physics.OdePlugin
743 m_taintforce = false; 749 m_taintforce = false;
744 750
745 } 751 }
746 752 private void changevelocity(float timestep)
753 {
754 System.Threading.Thread.Sleep(20);
755 if (IsPhysical)
756 {
757 if (Body != (IntPtr)0)
758 {
759 d.BodySetLinearVel(Body, m_taintVelocity.X, m_taintVelocity.Y, m_taintVelocity.Z);
760 }
761 }
762 m_taintVelocity = PhysicsVector.Zero;
763 }
747 public override bool IsPhysical 764 public override bool IsPhysical
748 { 765 {
749 get { return m_isphysical; } 766 get { return m_isphysical; }
@@ -838,7 +855,14 @@ namespace OpenSim.Region.Physics.OdePlugin
838 returnVelocity.Z = (m_lastVelocity.Z + _velocity.Z)/2; 855 returnVelocity.Z = (m_lastVelocity.Z + _velocity.Z)/2;
839 return returnVelocity; 856 return returnVelocity;
840 } 857 }
841 set { _velocity = value; } 858 set {
859 _velocity = value;
860
861 m_taintVelocity = value;
862 _parent_scene.AddPhysicsActorTaint(this);
863
864
865 }
842 } 866 }
843 867
844 public override bool Kinematic 868 public override bool Kinematic
@@ -898,16 +922,24 @@ namespace OpenSim.Region.Physics.OdePlugin
898 d.Vector3 rotvel = d.BodyGetAngularVel(Body); 922 d.Vector3 rotvel = d.BodyGetAngularVel(Body);
899 923
900 PhysicsVector l_position = new PhysicsVector(); 924 PhysicsVector l_position = new PhysicsVector();
925
926
901 // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!) 927 // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!)
902 if (vec.X < 0.0f) vec.X = 0.0f; 928 //if (vec.X < 0.0f) vec.X = 0.0f;
903 if (vec.Y < 0.0f) vec.Y = 0.0f; 929 //if (vec.Y < 0.0f) vec.Y = 0.0f;
904 if (vec.X > 255.95f) vec.X = 255.95f; 930 //if (vec.X > 255.95f) vec.X = 255.95f;
905 if (vec.Y > 255.95f) vec.Y = 255.95f; 931 //if (vec.Y > 255.95f) vec.Y = 255.95f;
906 m_lastposition = _position; 932 m_lastposition = _position;
907 933
908 l_position.X = vec.X; 934 l_position.X = vec.X;
909 l_position.Y = vec.Y; 935 l_position.Y = vec.Y;
910 l_position.Z = vec.Z; 936 l_position.Z = vec.Z;
937
938 if (l_position.X > 257f || l_position.X < -1f || l_position.Y > 257f || l_position.Y < -1f)
939 {
940 base.RequestPhysicsterseUpdate();
941 }
942
911 if (l_position.Z < 0) 943 if (l_position.Z < 0)
912 { 944 {
913 // This is so prim that get lost underground don't fall forever and suck up 945 // This is so prim that get lost underground don't fall forever and suck up