aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-11-27 02:08:22 +0000
committerJustin Clark-Casey (justincc)2013-11-27 02:08:22 +0000
commit0785210e29c75b09084321dca0569c9e4b73f858 (patch)
tree2ed2c7661b66b7c3bc50f76db9950621fcfef233 /OpenSim/Region/Framework/Scenes/ScenePresence.cs
parentOnly translate linked prim specified offset pos by the link prim rotation, no... (diff)
downloadopensim-SC_OLD-0785210e29c75b09084321dca0569c9e4b73f858.zip
opensim-SC_OLD-0785210e29c75b09084321dca0569c9e4b73f858.tar.gz
opensim-SC_OLD-0785210e29c75b09084321dca0569c9e4b73f858.tar.bz2
opensim-SC_OLD-0785210e29c75b09084321dca0569c9e4b73f858.tar.xz
Fix stand positions rather than having the stand jump to the root prim.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs56
1 files changed, 49 insertions, 7 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index a73d140..f9b598f 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -499,6 +499,7 @@ namespace OpenSim.Region.Framework.Scenes
499 } 499 }
500 else 500 else
501 { 501 {
502// m_log.DebugFormat("[SCENE PRESENCE]: Fetching abs pos where PhysicsActor == null and parent part {0} for {1}", Name, Scene.Name);
502 // Obtain the correct position of a seated avatar. 503 // Obtain the correct position of a seated avatar.
503 // In addition to providing the correct position while 504 // In addition to providing the correct position while
504 // the avatar is seated, this value will also 505 // the avatar is seated, this value will also
@@ -515,14 +516,14 @@ namespace OpenSim.Region.Framework.Scenes
515 SceneObjectPart sitPart = ParentPart; 516 SceneObjectPart sitPart = ParentPart;
516 517
517 if (sitPart != null) 518 if (sitPart != null)
518 return sitPart.AbsolutePosition + (m_pos * sitPart.GetWorldRotation()); 519 return sitPart.AbsolutePosition;
519 } 520 }
520 521
521 return m_pos; 522 return m_pos;
522 } 523 }
523 set 524 set
524 { 525 {
525// m_log.DebugFormat("[SCENE PRESENCE]: Setting position of {0} in {1} to {2}", Name, Scene.Name, value); 526// m_log.DebugFormat("[SCENE PRESENCE]: Setting position of {0} to {1} in {2}", Name, value, Scene.Name);
526// Util.PrintCallStack(); 527// Util.PrintCallStack();
527 528
528 if (PhysicsActor != null) 529 if (PhysicsActor != null)
@@ -2174,8 +2175,6 @@ namespace OpenSim.Region.Framework.Scenes
2174// m_log.DebugFormat("[SCENE PRESENCE]: StandUp() for {0}", Name); 2175// m_log.DebugFormat("[SCENE PRESENCE]: StandUp() for {0}", Name);
2175 2176
2176 SitGround = false; 2177 SitGround = false;
2177 if (PhysicsActor == null)
2178 AddToPhysicalScene(false);
2179 2178
2180 if (ParentID != 0) 2179 if (ParentID != 0)
2181 { 2180 {
@@ -2198,11 +2197,53 @@ namespace OpenSim.Region.Framework.Scenes
2198 ParentPosition = part.GetWorldPosition(); 2197 ParentPosition = part.GetWorldPosition();
2199 ControllingClient.SendClearFollowCamProperties(part.ParentUUID); 2198 ControllingClient.SendClearFollowCamProperties(part.ParentUUID);
2200 2199
2201 m_pos += ParentPosition + new Vector3(0.0f, 0.0f, 2.0f * m_sitAvatarHeight);
2202 ParentPosition = Vector3.Zero;
2203
2204 ParentID = 0; 2200 ParentID = 0;
2205 ParentPart = null; 2201 ParentPart = null;
2202
2203 Quaternion standRotation;
2204
2205 if (part.SitTargetAvatar == UUID)
2206 {
2207 standRotation = part.GetWorldRotation();
2208
2209 if (!part.IsRoot)
2210 standRotation = standRotation * part.SitTargetOrientation;
2211// standRotation = part.RotationOffset * part.SitTargetOrientation;
2212// else
2213// standRotation = part.SitTargetOrientation;
2214
2215 }
2216 else
2217 {
2218 standRotation = Rotation;
2219 }
2220
2221 //Vector3 standPos = ParentPosition + new Vector3(0.0f, 0.0f, 2.0f * m_sitAvatarHeight);
2222 //Vector3 standPos = ParentPosition;
2223
2224// Vector3 standPositionAdjustment
2225// = part.SitTargetPosition + new Vector3(0.5f, 0f, m_sitAvatarHeight / 2f);
2226 Vector3 adjustmentForSitPosition = part.SitTargetPosition * part.GetWorldRotation();
2227
2228 // XXX: This is based on the physics capsule sizes. Need to find a better way to read this rather than
2229 // hardcoding here.
2230 Vector3 adjustmentForSitPose = new Vector3(0.74f, 0f, 0f) * standRotation;
2231
2232 Vector3 standPos = ParentPosition + adjustmentForSitPosition + adjustmentForSitPose;
2233
2234 m_log.DebugFormat(
2235 "[SCENE PRESENCE]: Setting stand to pos {0}, (adjustmentForSitPosition {1}, adjustmentForSitPose {2}) rotation {3} for {4} in {5}",
2236 standPos, adjustmentForSitPosition, adjustmentForSitPose, standRotation, Name, Scene.Name);
2237
2238 Rotation = standRotation;
2239 AbsolutePosition = standPos;
2240 ParentPosition = Vector3.Zero;
2241
2242 // We need to wait until we have calculated proper stand positions before sitting up the physical
2243 // avatar to avoid race conditions.
2244 if (PhysicsActor == null)
2245 AddToPhysicalScene(false);
2246
2206 SendAvatarDataToAllAgents(); 2247 SendAvatarDataToAllAgents();
2207 m_requestedSitTargetID = 0; 2248 m_requestedSitTargetID = 0;
2208 2249
@@ -2859,6 +2900,7 @@ namespace OpenSim.Region.Framework.Scenes
2859 lastTerseUpdateToAllClientsTick = currentTick; 2900 lastTerseUpdateToAllClientsTick = currentTick;
2860 lastPositionSentToAllClients = OffsetPosition; 2901 lastPositionSentToAllClients = OffsetPosition;
2861 2902
2903// Console.WriteLine("Scheduled update for {0} in {1}", Name, Scene.Name);
2862 m_scene.ForEachClient(SendTerseUpdateToClient); 2904 m_scene.ForEachClient(SendTerseUpdateToClient);
2863 } 2905 }
2864 TriggerScenePresenceUpdated(); 2906 TriggerScenePresenceUpdated();