aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-11-05 01:38:42 +0000
committerJustin Clark-Casey (justincc)2011-11-05 01:38:42 +0000
commit28c4dc9be490a3beedccb17bc1b411e45cced846 (patch)
treea399c6faf3f08e53f20ae4aba546aff9cfdd083e /OpenSim/Region/Framework
parentAdd comment for experimental effect of removing the Thread.Sleep(20) in ODEPr... (diff)
downloadopensim-SC_OLD-28c4dc9be490a3beedccb17bc1b411e45cced846.zip
opensim-SC_OLD-28c4dc9be490a3beedccb17bc1b411e45cced846.tar.gz
opensim-SC_OLD-28c4dc9be490a3beedccb17bc1b411e45cced846.tar.bz2
opensim-SC_OLD-28c4dc9be490a3beedccb17bc1b411e45cced846.tar.xz
Fix NPC sitting for prims without a sit target.
This is to partially address http://opensimulator.org/mantis/view.php?id=5769 We don't need to call SP.HandleAgentSit() again if we are within 10m since the autopilot won't trigger. By calling it twice, the position of the sitting NPC was wrongly adjusted, ending up near <0,0,0>. However, this change does mean that NPCs further than 10m away will not attempt to autopilot to the prim, though this code was broken anyway (is actually a different mechanism to normal NPC movmeent). Hopefully this can be addressed soon.
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs12
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs20
2 files changed, 21 insertions, 11 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index b77f1b6..4071159 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1096,13 +1096,21 @@ namespace OpenSim.Region.Framework.Scenes
1096 public Quaternion SitTargetOrientation 1096 public Quaternion SitTargetOrientation
1097 { 1097 {
1098 get { return m_sitTargetOrientation; } 1098 get { return m_sitTargetOrientation; }
1099 set { m_sitTargetOrientation = value; } 1099 set
1100 {
1101 m_sitTargetOrientation = value;
1102// m_log.DebugFormat("[SCENE OBJECT PART]: Set sit target orientation {0} for {1} {2}", m_sitTargetOrientation, Name, LocalId);
1103 }
1100 } 1104 }
1101 1105
1102 public Vector3 SitTargetPosition 1106 public Vector3 SitTargetPosition
1103 { 1107 {
1104 get { return m_sitTargetPosition; } 1108 get { return m_sitTargetPosition; }
1105 set { m_sitTargetPosition = value; } 1109 set
1110 {
1111 m_sitTargetPosition = value;
1112// m_log.DebugFormat("[SCENE OBJECT PART]: Set sit target position to {0} for {1} {2}", m_sitTargetPosition, Name, LocalId);
1113 }
1106 } 1114 }
1107 1115
1108 // This sort of sucks, but I'm adding these in to make some of 1116 // This sort of sucks, but I'm adding these in to make some of
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 89e511f..4156f21 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -89,7 +89,7 @@ namespace OpenSim.Region.Framework.Scenes
89 /// rotation, prim cut, prim twist, prim taper, and prim shear. See mantis 89 /// rotation, prim cut, prim twist, prim taper, and prim shear. See mantis
90 /// issue #1716 90 /// issue #1716
91 /// </summary> 91 /// </summary>
92 private static readonly Vector3 SIT_TARGET_ADJUSTMENT = new Vector3(0.1f, 0.0f, 0.3f); 92 public static readonly Vector3 SIT_TARGET_ADJUSTMENT = new Vector3(0.1f, 0.0f, 0.3f);
93 93
94 /// <summary> 94 /// <summary>
95 /// Movement updates for agents in neighboring regions are sent directly to clients. 95 /// Movement updates for agents in neighboring regions are sent directly to clients.
@@ -1873,7 +1873,7 @@ namespace OpenSim.Region.Framework.Scenes
1873 AddToPhysicalScene(false); 1873 AddToPhysicalScene(false);
1874 } 1874 }
1875 1875
1876 m_pos += ParentPosition + new Vector3(0.0f, 0.0f, 2.0f*m_sitAvatarHeight); 1876 m_pos += ParentPosition + new Vector3(0.0f, 0.0f, 2.0f * m_sitAvatarHeight);
1877 ParentPosition = Vector3.Zero; 1877 ParentPosition = Vector3.Zero;
1878 1878
1879 ParentID = 0; 1879 ParentID = 0;
@@ -2283,6 +2283,10 @@ namespace OpenSim.Region.Framework.Scenes
2283 Vector3 sitTargetPos = part.SitTargetPosition; 2283 Vector3 sitTargetPos = part.SitTargetPosition;
2284 Quaternion sitTargetOrient = part.SitTargetOrientation; 2284 Quaternion sitTargetOrient = part.SitTargetOrientation;
2285 2285
2286// m_log.DebugFormat(
2287// "[SCENE PRESENCE]: Sitting {0} at sit target {1}, {2} on {3} {4}",
2288// Name, sitTargetPos, sitTargetOrient, part.Name, part.LocalId);
2289
2286 //Quaternion vq = new Quaternion(sitTargetPos.X, sitTargetPos.Y+0.2f, sitTargetPos.Z+0.2f, 0); 2290 //Quaternion vq = new Quaternion(sitTargetPos.X, sitTargetPos.Y+0.2f, sitTargetPos.Z+0.2f, 0);
2287 //Quaternion nq = new Quaternion(-sitTargetOrient.X, -sitTargetOrient.Y, -sitTargetOrient.Z, sitTargetOrient.w); 2291 //Quaternion nq = new Quaternion(-sitTargetOrient.X, -sitTargetOrient.Y, -sitTargetOrient.Z, sitTargetOrient.w);
2288 2292
@@ -2291,15 +2295,17 @@ namespace OpenSim.Region.Framework.Scenes
2291 m_pos = new Vector3(sitTargetPos.X, sitTargetPos.Y, sitTargetPos.Z); 2295 m_pos = new Vector3(sitTargetPos.X, sitTargetPos.Y, sitTargetPos.Z);
2292 m_pos += SIT_TARGET_ADJUSTMENT; 2296 m_pos += SIT_TARGET_ADJUSTMENT;
2293 Rotation = sitTargetOrient; 2297 Rotation = sitTargetOrient;
2294 //Rotation = sitTargetOrient;
2295 ParentPosition = part.AbsolutePosition; 2298 ParentPosition = part.AbsolutePosition;
2296
2297 //SendTerseUpdateToAllClients();
2298 } 2299 }
2299 else 2300 else
2300 { 2301 {
2301 m_pos -= part.AbsolutePosition; 2302 m_pos -= part.AbsolutePosition;
2303
2302 ParentPosition = part.AbsolutePosition; 2304 ParentPosition = part.AbsolutePosition;
2305
2306// m_log.DebugFormat(
2307// "[SCENE PRESENCE]: Sitting {0} at position {1} ({2} + {3}) on part {4} {5} without sit target",
2308// Name, part.AbsolutePosition, m_pos, ParentPosition, part.Name, part.LocalId);
2303 } 2309 }
2304 } 2310 }
2305 else 2311 else
@@ -2314,10 +2320,6 @@ namespace OpenSim.Region.Framework.Scenes
2314 2320
2315 Animator.TrySetMovementAnimation(sitAnimation); 2321 Animator.TrySetMovementAnimation(sitAnimation);
2316 SendAvatarDataToAllAgents(); 2322 SendAvatarDataToAllAgents();
2317 // This may seem stupid, but Our Full updates don't send avatar rotation :P
2318 // So we're also sending a terse update (which has avatar rotation)
2319 // [Update] We do now.
2320 //SendTerseUpdateToAllClients();
2321 } 2323 }
2322 2324
2323 /// <summary> 2325 /// <summary>