aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs55
1 files changed, 46 insertions, 9 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 8c56975..17f54c2 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -208,7 +208,6 @@ namespace OpenSim.Region.Framework.Scenes
208// private int m_lastColCount = -1; //KF: Look for Collision chnages 208// private int m_lastColCount = -1; //KF: Look for Collision chnages
209// private int m_updateCount = 0; //KF: Update Anims for a while 209// private int m_updateCount = 0; //KF: Update Anims for a while
210// private static readonly int UPDATE_COUNT = 10; // how many frames to update for 210// private static readonly int UPDATE_COUNT = 10; // how many frames to update for
211 private List<uint> m_lastColliders = new List<uint>();
212 211
213 private TeleportFlags m_teleportFlags; 212 private TeleportFlags m_teleportFlags;
214 public TeleportFlags TeleportFlags 213 public TeleportFlags TeleportFlags
@@ -271,8 +270,6 @@ namespace OpenSim.Region.Framework.Scenes
271 //private int m_moveToPositionStateStatus; 270 //private int m_moveToPositionStateStatus;
272 //***************************************************** 271 //*****************************************************
273 272
274 private object m_collisionEventLock = new Object();
275
276 private int m_movementAnimationUpdateCounter = 0; 273 private int m_movementAnimationUpdateCounter = 0;
277 274
278 public Vector3 PrevSitOffset { get; set; } 275 public Vector3 PrevSitOffset { get; set; }
@@ -1328,6 +1325,11 @@ namespace OpenSim.Region.Framework.Scenes
1328 1325
1329 m_log.DebugFormat("[SCENE PRESENCE]: Making {0} a child agent in {1}", Name, Scene.RegionInfo.RegionName); 1326 m_log.DebugFormat("[SCENE PRESENCE]: Making {0} a child agent in {1}", Name, Scene.RegionInfo.RegionName);
1330 1327
1328 // Reset the m_originRegionID as it has dual use as a flag to signal that the UpdateAgent() call orignating
1329 // from the source simulator has completed on a V2 teleport.
1330 lock (m_originRegionIDAccessLock)
1331 m_originRegionID = UUID.Zero;
1332
1331 // Reset these so that teleporting in and walking out isn't seen 1333 // Reset these so that teleporting in and walking out isn't seen
1332 // as teleporting back 1334 // as teleporting back
1333 TeleportFlags = TeleportFlags.Default; 1335 TeleportFlags = TeleportFlags.Default;
@@ -2752,7 +2754,34 @@ namespace OpenSim.Region.Framework.Scenes
2752 part.AddSittingAvatar(this); 2754 part.AddSittingAvatar(this);
2753 2755
2754 cameraAtOffset = part.GetCameraAtOffset(); 2756 cameraAtOffset = part.GetCameraAtOffset();
2757
2758 if (!part.IsRoot && cameraAtOffset == Vector3.Zero)
2759 cameraAtOffset = part.ParentGroup.RootPart.GetCameraAtOffset();
2760
2761 bool cameraEyeOffsetFromRootForChild = false;
2755 cameraEyeOffset = part.GetCameraEyeOffset(); 2762 cameraEyeOffset = part.GetCameraEyeOffset();
2763
2764 if (!part.IsRoot && cameraEyeOffset == Vector3.Zero)
2765 {
2766 cameraEyeOffset = part.ParentGroup.RootPart.GetCameraEyeOffset();
2767 cameraEyeOffsetFromRootForChild = true;
2768 }
2769
2770 if ((cameraEyeOffset != Vector3.Zero && !cameraEyeOffsetFromRootForChild) || cameraAtOffset != Vector3.Zero)
2771 {
2772 if (!part.IsRoot)
2773 {
2774 cameraEyeOffset = cameraEyeOffset * part.RotationOffset;
2775 cameraAtOffset += part.OffsetPosition;
2776 }
2777
2778 cameraEyeOffset += part.OffsetPosition;
2779 }
2780
2781// m_log.DebugFormat(
2782// "[SCENE PRESENCE]: Using cameraAtOffset {0}, cameraEyeOffset {1} for sit on {2} by {3} in {4}",
2783// cameraAtOffset, cameraEyeOffset, part.Name, Name, Scene.Name);
2784
2756 forceMouselook = part.GetForceMouselook(); 2785 forceMouselook = part.GetForceMouselook();
2757 2786
2758 // An viewer expects to specify sit positions as offsets to the root prim, even if a child prim is 2787 // An viewer expects to specify sit positions as offsets to the root prim, even if a child prim is
@@ -3772,10 +3801,15 @@ namespace OpenSim.Region.Framework.Scenes
3772 if (!IsChildAgent) 3801 if (!IsChildAgent)
3773 return; 3802 return;
3774 3803
3775 //m_log.Debug(" >>> ChildAgentPositionUpdate <<< " + rRegionX + "-" + rRegionY); 3804// m_log.DebugFormat(
3805// "[SCENE PRESENCE]: ChildAgentPositionUpdate for {0} in {1}, tRegion {2},{3}, rRegion {4},{5}, pos {6}",
3806// Name, Scene.Name, tRegionX, tRegionY, rRegionX, rRegionY, cAgentData.Position);
3807
3776 // Find the distance (in meters) between the two regions 3808 // Find the distance (in meters) between the two regions
3777 uint shiftx = Util.RegionToWorldLoc(rRegionX - tRegionX); 3809 // XXX: We cannot use Util.RegionLocToHandle() here because a negative value will silently overflow the
3778 uint shifty = Util.RegionToWorldLoc(rRegionY - tRegionY); 3810 // uint
3811 int shiftx = (int)(((int)rRegionX - (int)tRegionX) * Constants.RegionSize);
3812 int shifty = (int)(((int)rRegionY - (int)tRegionY) * Constants.RegionSize);
3779 3813
3780 Vector3 offset = new Vector3(shiftx, shifty, 0f); 3814 Vector3 offset = new Vector3(shiftx, shifty, 0f);
3781 3815
@@ -3876,9 +3910,6 @@ namespace OpenSim.Region.Framework.Scenes
3876 3910
3877 private void CopyFrom(AgentData cAgent) 3911 private void CopyFrom(AgentData cAgent)
3878 { 3912 {
3879 lock (m_originRegionIDAccessLock)
3880 m_originRegionID = cAgent.RegionID;
3881
3882 m_callbackURI = cAgent.CallbackURI; 3913 m_callbackURI = cAgent.CallbackURI;
3883// m_log.DebugFormat( 3914// m_log.DebugFormat(
3884// "[SCENE PRESENCE]: Set callback for {0} in {1} to {2} in CopyFrom()", 3915// "[SCENE PRESENCE]: Set callback for {0} in {1} to {2} in CopyFrom()",
@@ -3951,6 +3982,12 @@ namespace OpenSim.Region.Framework.Scenes
3951 3982
3952 if (Scene.AttachmentsModule != null) 3983 if (Scene.AttachmentsModule != null)
3953 Scene.AttachmentsModule.CopyAttachments(cAgent, this); 3984 Scene.AttachmentsModule.CopyAttachments(cAgent, this);
3985
3986 // This must occur after attachments are copied, as it releases the CompleteMovement() calling thread
3987 // originating from the client completing a teleport. Otherwise, CompleteMovement() code to restart
3988 // script attachments can outrace this thread.
3989 lock (m_originRegionIDAccessLock)
3990 m_originRegionID = cAgent.RegionID;
3954 } 3991 }
3955 3992
3956 public bool CopyAgent(out IAgentData agent) 3993 public bool CopyAgent(out IAgentData agent)