aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorTeravus Ovares2009-07-17 07:28:09 +0000
committerTeravus Ovares2009-07-17 07:28:09 +0000
commitf74622c65fe8934d5f3b69975e8dba24d02985fe (patch)
treeff0bd8a26de159686987b7d57820b614429e5afa
parentRevert the nonessential part of r10033 to restore sanity to trampolines (diff)
downloadopensim-SC_OLD-f74622c65fe8934d5f3b69975e8dba24d02985fe.zip
opensim-SC_OLD-f74622c65fe8934d5f3b69975e8dba24d02985fe.tar.gz
opensim-SC_OLD-f74622c65fe8934d5f3b69975e8dba24d02985fe.tar.bz2
opensim-SC_OLD-f74622c65fe8934d5f3b69975e8dba24d02985fe.tar.xz
* Change the order of Update so Physics processes a frame before the scene manipulates the physics Scene.cs
* Remove the draconic locking around adding an avatar to the Scene * Handle an extreme error case when border crossing fails and user uses map to teleport to a different region on the same instance causing control commands to go to a child agent. * Make the Set Appearance method use the proper 'remove from physics scene' method. * It *may* help border crossings. * It *may* help the 'on avatar rez' lag, that people have been seeing the past week. * It may also cause physics to crash more often on failed teleports (though.. I think I got the cases covered).
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs38
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs105
2 files changed, 89 insertions, 54 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 660ee8d..81d54e7 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -901,24 +901,7 @@ namespace OpenSim.Region.Framework.Scenes
901 if (m_frame == Int32.MaxValue) 901 if (m_frame == Int32.MaxValue)
902 m_frame = 0; 902 m_frame = 0;
903 903
904 physicsMS2 = Environment.TickCount; 904
905 if ((m_frame % m_update_physics == 0) && m_physics_enabled)
906 m_sceneGraph.UpdatePreparePhysics();
907 physicsMS2 = Environment.TickCount - physicsMS2;
908
909 if (m_frame % m_update_entitymovement == 0)
910 m_sceneGraph.UpdateEntityMovement();
911
912 physicsMS = Environment.TickCount;
913 if ((m_frame % m_update_physics == 0) && m_physics_enabled)
914 physicsFPS = m_sceneGraph.UpdatePhysics(
915 Math.Max(SinceLastFrame.TotalSeconds, m_timespan)
916 );
917 if (m_frame % m_update_physics == 0 && SynchronizeScene != null)
918 SynchronizeScene(this);
919
920 physicsMS = Environment.TickCount - physicsMS;
921 physicsMS += physicsMS2;
922 905
923 otherMS = Environment.TickCount; 906 otherMS = Environment.TickCount;
924 // run through all entities looking for updates (slow) 907 // run through all entities looking for updates (slow)
@@ -949,6 +932,25 @@ namespace OpenSim.Region.Framework.Scenes
949 if (m_frame % m_update_presences == 0) 932 if (m_frame % m_update_presences == 0)
950 m_sceneGraph.UpdatePresences(); 933 m_sceneGraph.UpdatePresences();
951 934
935 physicsMS2 = Environment.TickCount;
936 if ((m_frame % m_update_physics == 0) && m_physics_enabled)
937 m_sceneGraph.UpdatePreparePhysics();
938 physicsMS2 = Environment.TickCount - physicsMS2;
939
940 if (m_frame % m_update_entitymovement == 0)
941 m_sceneGraph.UpdateEntityMovement();
942
943 physicsMS = Environment.TickCount;
944 if ((m_frame % m_update_physics == 0) && m_physics_enabled)
945 physicsFPS = m_sceneGraph.UpdatePhysics(
946 Math.Max(SinceLastFrame.TotalSeconds, m_timespan)
947 );
948 if (m_frame % m_update_physics == 0 && SynchronizeScene != null)
949 SynchronizeScene(this);
950
951 physicsMS = Environment.TickCount - physicsMS;
952 physicsMS += physicsMS2;
953
952 // Delete temp-on-rez stuff 954 // Delete temp-on-rez stuff
953 if (m_frame % m_update_backup == 0) 955 if (m_frame % m_update_backup == 0)
954 CleanTempObjects(); 956 CleanTempObjects();
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 96a3425..87207a0 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -870,14 +870,11 @@ namespace OpenSim.Region.Framework.Scenes
870 { 870 {
871 if (PhysicsActor != null) 871 if (PhysicsActor != null)
872 { 872 {
873 lock (m_scene.SyncRoot) 873 m_physicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients;
874 { 874 m_scene.PhysicsScene.RemoveAvatar(PhysicsActor);
875 m_physicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; 875 m_physicsActor.UnSubscribeEvents();
876 m_scene.PhysicsScene.RemoveAvatar(PhysicsActor); 876 m_physicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate;
877 m_physicsActor.UnSubscribeEvents(); 877 PhysicsActor = null;
878 m_physicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate;
879 PhysicsActor = null;
880 }
881 } 878 }
882 } 879 }
883 880
@@ -999,7 +996,7 @@ namespace OpenSim.Region.Framework.Scenes
999 internal void SetHeight(float height) 996 internal void SetHeight(float height)
1000 { 997 {
1001 m_avHeight = height; 998 m_avHeight = height;
1002 if (PhysicsActor != null) 999 if (PhysicsActor != null && !IsChildAgent)
1003 { 1000 {
1004 PhysicsVector SetSize = new PhysicsVector(0.45f, 0.6f, m_avHeight); 1001 PhysicsVector SetSize = new PhysicsVector(0.45f, 0.6f, m_avHeight);
1005 PhysicsActor.Size = SetSize; 1002 PhysicsActor.Size = SetSize;
@@ -2219,7 +2216,35 @@ namespace OpenSim.Region.Framework.Scenes
2219 { 2216 {
2220 if (m_isChildAgent) 2217 if (m_isChildAgent)
2221 { 2218 {
2222 m_log.Debug("DEBUG: AddNewMovement: child agent"); 2219 m_log.Debug("DEBUG: AddNewMovement: child agent, Making root agent!");
2220
2221 // we have to reset the user's child agent connections.
2222 // Likely, here they've lost the eventqueue for other regions so border
2223 // crossings will fail at this point unless we reset them.
2224
2225 List<ulong> regions = new List<ulong>(KnownChildRegionHandles);
2226 regions.Remove(m_scene.RegionInfo.RegionHandle);
2227
2228 MakeRootAgent(new Vector3(127, 127, 127), true);
2229
2230 // Async command
2231 if (m_scene.SceneGridService != null)
2232 {
2233 m_scene.SceneGridService.SendCloseChildAgentConnections(UUID, regions);
2234
2235 // Give the above command some time to try and close the connections.
2236 // this is really an emergency.. so sleep, or we'll get all discombobulated.
2237 System.Threading.Thread.Sleep(500);
2238 }
2239
2240
2241 if (m_scene.SceneGridService != null)
2242 {
2243 m_scene.SceneGridService.EnableNeighbourChildAgents(this, new List<RegionInfo>());
2244 }
2245
2246
2247
2223 return; 2248 return;
2224 } 2249 }
2225 2250
@@ -2554,11 +2579,19 @@ namespace OpenSim.Region.Framework.Scenes
2554 { 2579 {
2555 if (m_physicsActor != null) 2580 if (m_physicsActor != null)
2556 { 2581 {
2557 // This may seem like it's redundant, remove the avatar from the physics scene 2582 if (!IsChildAgent)
2558 // just to add it back again, but it saves us from having to update 2583 {
2559 // 3 variables 10 times a second. 2584 // This may seem like it's redundant, remove the avatar from the physics scene
2560 m_scene.PhysicsScene.RemoveAvatar(m_physicsActor); 2585 // just to add it back again, but it saves us from having to update
2561 AddToPhysicalScene(m_physicsActor.Flying); 2586 // 3 variables 10 times a second.
2587 bool flyingTemp = m_physicsActor.Flying;
2588 RemoveFromPhysicalScene();
2589 //m_scene.PhysicsScene.RemoveAvatar(m_physicsActor);
2590
2591 //PhysicsActor = null;
2592
2593 AddToPhysicalScene(flyingTemp);
2594 }
2562 } 2595 }
2563 m_appearance.SetAppearance(texture, visualParam); 2596 m_appearance.SetAppearance(texture, visualParam);
2564 if (m_appearance.AvatarHeight > 0) 2597 if (m_appearance.AvatarHeight > 0)
@@ -3188,30 +3221,30 @@ namespace OpenSim.Region.Framework.Scenes
3188 /// </summary> 3221 /// </summary>
3189 public void AddToPhysicalScene(bool isFlying) 3222 public void AddToPhysicalScene(bool isFlying)
3190 { 3223 {
3191 lock (m_scene.SyncRoot) 3224
3192 { 3225 PhysicsScene scene = m_scene.PhysicsScene;
3193 PhysicsScene scene = m_scene.PhysicsScene;
3194 3226
3195 PhysicsVector pVec = 3227 PhysicsVector pVec =
3196 new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y, 3228 new PhysicsVector(AbsolutePosition.X, AbsolutePosition.Y,
3197 AbsolutePosition.Z); 3229 AbsolutePosition.Z);
3198 3230
3199 if (m_avHeight == 127.0f) 3231 // Old bug where the height was in centimeters instead of meters
3200 { 3232 if (m_avHeight == 127.0f)
3201 m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new PhysicsVector(0, 0, 1.56f), 3233 {
3202 isFlying); 3234 m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new PhysicsVector(0, 0, 1.56f),
3203 } 3235 isFlying);
3204 else
3205 {
3206 m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec,
3207 new PhysicsVector(0, 0, m_avHeight), isFlying);
3208 }
3209 scene.AddPhysicsActorTaint(m_physicsActor);
3210 //m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients;
3211 m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate;
3212 m_physicsActor.SubscribeEvents(1000);
3213 m_physicsActor.LocalID = LocalId;
3214 } 3236 }
3237 else
3238 {
3239 m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec,
3240 new PhysicsVector(0, 0, m_avHeight), isFlying);
3241 }
3242 scene.AddPhysicsActorTaint(m_physicsActor);
3243 //m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients;
3244 m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate;
3245 m_physicsActor.SubscribeEvents(1000);
3246 m_physicsActor.LocalID = LocalId;
3247
3215 } 3248 }
3216 3249
3217 // Event called by the physics plugin to tell the avatar about a collision. 3250 // Event called by the physics plugin to tell the avatar about a collision.