aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs24
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs61
2 files changed, 30 insertions, 55 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index a3206015..3cd4a10 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -230,27 +230,9 @@ namespace OpenSim.Region.Framework.Scenes
230 if (sp.IsChildAgent) 230 if (sp.IsChildAgent)
231 continue; 231 continue;
232 232
233 if (sp.ParentID != 0) 233 coarseLocations.Add(sp.AbsolutePosition);
234 { 234
235 // sitting avatar 235 avatarUUIDs.Add(sp.UUID);
236 SceneObjectPart sop = m_parentScene.GetSceneObjectPart(sp.ParentID);
237 if (sop != null)
238 {
239 coarseLocations.Add(sop.AbsolutePosition + sp.OffsetPosition);
240 avatarUUIDs.Add(sp.UUID);
241 }
242 else
243 {
244 // we can't find the parent.. ! arg!
245 coarseLocations.Add(sp.AbsolutePosition);
246 avatarUUIDs.Add(sp.UUID);
247 }
248 }
249 else
250 {
251 coarseLocations.Add(sp.AbsolutePosition);
252 avatarUUIDs.Add(sp.UUID);
253 }
254 } 236 }
255 } 237 }
256 238
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 4190cf6..c4aaebe 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -438,7 +438,7 @@ namespace OpenSim.Region.Framework.Scenes
438 { 438 {
439 get 439 get
440 { 440 {
441 if (PhysicsActor != null && m_parentID == 0) 441 if (PhysicsActor != null)
442 { 442 {
443 m_pos = PhysicsActor.Position; 443 m_pos = PhysicsActor.Position;
444 444
@@ -461,12 +461,12 @@ namespace OpenSim.Region.Framework.Scenes
461 // in the sim unless the avatar is on a sit target. While 461 // in the sim unless the avatar is on a sit target. While
462 // on a sit target, m_pos will contain the desired offset 462 // on a sit target, m_pos will contain the desired offset
463 // without the parent rotation applied. 463 // without the parent rotation applied.
464 if (ParentID != 0) 464 SceneObjectPart sitPart = ParentPart;
465 { 465
466 SceneObjectPart part = ParentPart; 466 if (sitPart != null)
467 return part.AbsolutePosition + (m_pos * part.GetWorldRotation()); 467 return sitPart.AbsolutePosition + (m_pos * sitPart.GetWorldRotation());
468 }
469 } 468 }
469
470 return m_pos; 470 return m_pos;
471 } 471 }
472 set 472 set
@@ -483,7 +483,7 @@ namespace OpenSim.Region.Framework.Scenes
483 } 483 }
484 } 484 }
485 485
486 // Don't update while sitting 486 // Don't update while sitting. The PhysicsActor above is null whilst sitting.
487 if (ParentID == 0) 487 if (ParentID == 0)
488 { 488 {
489 m_pos = value; 489 m_pos = value;
@@ -510,6 +510,7 @@ namespace OpenSim.Region.Framework.Scenes
510 // There is no offset position when not seated 510 // There is no offset position when not seated
511 if (ParentID == 0) 511 if (ParentID == 0)
512 return; 512 return;
513
513 m_pos = value; 514 m_pos = value;
514 } 515 }
515 } 516 }
@@ -568,12 +569,10 @@ namespace OpenSim.Region.Framework.Scenes
568 569
569 public bool IsChildAgent { get; set; } 570 public bool IsChildAgent { get; set; }
570 571
571 public uint ParentID 572 /// <summary>
572 { 573 /// If the avatar is sitting, the local ID of the prim that it's sitting on. If not sitting then zero.
573 get { return m_parentID; } 574 /// </summary>
574 set { m_parentID = value; } 575 public uint ParentID { get; set; }
575 }
576 private uint m_parentID;
577 576
578 public UUID ParentUUID 577 public UUID ParentUUID
579 { 578 {
@@ -582,12 +581,13 @@ namespace OpenSim.Region.Framework.Scenes
582 } 581 }
583 private UUID m_parentUUID = UUID.Zero; 582 private UUID m_parentUUID = UUID.Zero;
584 583
585 public SceneObjectPart ParentPart 584 /// <summary>
586 { 585 /// If the avatar is sitting, the prim that it's sitting on. If not sitting then null.
587 get { return m_parentPart; } 586 /// </summary>
588 set { m_parentPart = value; } 587 /// <remarks>
589 } 588 /// If you use this property then you must take a reference since another thread could set it to null.
590 private SceneObjectPart m_parentPart = null; 589 /// </remarks>
590 public SceneObjectPart ParentPart { get; set; }
591 591
592 public float Health 592 public float Health
593 { 593 {
@@ -2285,23 +2285,16 @@ namespace OpenSim.Region.Framework.Scenes
2285// "[SCENE PRESENCE]: Sitting {0} at position {1} ({2} + {3}) on part {4} {5} without sit target", 2285// "[SCENE PRESENCE]: Sitting {0} at position {1} ({2} + {3}) on part {4} {5} without sit target",
2286// Name, part.AbsolutePosition, m_pos, ParentPosition, part.Name, part.LocalId); 2286// Name, part.AbsolutePosition, m_pos, ParentPosition, part.Name, part.LocalId);
2287 } 2287 }
2288 }
2289 else
2290 {
2291 return;
2292 }
2293
2294 ParentPart = m_scene.GetSceneObjectPart(m_requestedSitTargetID);
2295 if (ParentPart == null)
2296 return;
2297 2288
2298 ParentID = m_requestedSitTargetID; 2289 ParentPart = m_scene.GetSceneObjectPart(m_requestedSitTargetID);
2290 ParentID = m_requestedSitTargetID;
2299 2291
2300 Velocity = Vector3.Zero; 2292 Velocity = Vector3.Zero;
2301 RemoveFromPhysicalScene(); 2293 RemoveFromPhysicalScene();
2302 2294
2303 Animator.TrySetMovementAnimation(sitAnimation); 2295 Animator.TrySetMovementAnimation(sitAnimation);
2304 SendAvatarDataToAllAgents(); 2296 SendAvatarDataToAllAgents();
2297 }
2305 } 2298 }
2306 2299
2307 public void HandleAgentSitOnGround() 2300 public void HandleAgentSitOnGround()