aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorTom2010-08-06 06:37:40 -0700
committerTom2010-08-06 06:37:40 -0700
commita636af13e77aae588f425b7bc9504854a7ed1261 (patch)
tree1f12d84f52ec2318131765d9510525c7c8723b12 /OpenSim
parentMerge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/ca... (diff)
downloadopensim-SC_OLD-a636af13e77aae588f425b7bc9504854a7ed1261.zip
opensim-SC_OLD-a636af13e77aae588f425b7bc9504854a7ed1261.tar.gz
opensim-SC_OLD-a636af13e77aae588f425b7bc9504854a7ed1261.tar.bz2
opensim-SC_OLD-a636af13e77aae588f425b7bc9504854a7ed1261.tar.xz
Make sure the avatar position gets moved along with a prim it is sitting on. This fixes mantis #208 and (maybe) issues with chat and sound coming from the wrong place when sat on a vehicle.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs13
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs22
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs13
3 files changed, 32 insertions, 16 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index dbf493c..5a3dc20 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -469,13 +469,22 @@ namespace OpenSim.Region.Framework.Scenes
469 return; 469 return;
470 } 470 }
471 } 471 }
472 foreach (SceneObjectPart part in m_parts.Values) 472 List<SceneObjectPart> parts = new List<SceneObjectPart>(m_parts.Values);
473 lockPartsForRead(false);
474 foreach (SceneObjectPart part in parts)
473 { 475 {
474 part.IgnoreUndoUpdate = false; 476 part.IgnoreUndoUpdate = false;
475 part.StoreUndoState(UndoType.STATE_GROUP_POSITION); 477 part.StoreUndoState(UndoType.STATE_GROUP_POSITION);
476 part.GroupPosition = val; 478 part.GroupPosition = val;
477 } 479 }
478 lockPartsForRead(false); 480
481 foreach (ScenePresence av in m_linkedAvatars)
482 {
483 Vector3 offset = m_parts[av.LinkedPrim].GetWorldPosition() - av.ParentPosition;
484 av.AbsolutePosition += offset;
485 av.ParentPosition = m_parts[av.LinkedPrim].GetWorldPosition(); //ParentPosition gets cleared by AbsolutePosition
486 av.SendFullUpdateToAllClients();
487 }
479 488
480 //if (m_rootPart.PhysActor != null) 489 //if (m_rootPart.PhysActor != null)
481 //{ 490 //{
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index ba84b88..badd357 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -682,25 +682,13 @@ namespace OpenSim.Region.Framework.Scenes
682 682
683 // Tell the physics engines that this prim changed. 683 // Tell the physics engines that this prim changed.
684 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); 684 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor);
685
685 } 686 }
686 catch (Exception e) 687 catch (Exception e)
687 { 688 {
688 m_log.Error("[SCENEOBJECTPART]: GROUP POSITION. " + e.Message); 689 m_log.Error("[SCENEOBJECTPART]: GROUP POSITION. " + e.Message);
689 } 690 }
690 } 691 }
691
692 // TODO if we decide to do sitting in a more SL compatible way (multiple avatars per prim), this has to be fixed, too
693 if (m_sitTargetAvatar != UUID.Zero)
694 {
695 if (m_parentGroup != null) // TODO can there be a SOP without a SOG?
696 {
697 ScenePresence avatar;
698 if (m_parentGroup.Scene.TryGetScenePresence(m_sitTargetAvatar, out avatar))
699 {
700 avatar.ParentPosition = GetWorldPosition();
701 }
702 }
703 }
704 } 692 }
705 } 693 }
706 694
@@ -709,6 +697,7 @@ namespace OpenSim.Region.Framework.Scenes
709 get { return m_offsetPosition; } 697 get { return m_offsetPosition; }
710 set 698 set
711 { 699 {
700 Vector3 oldpos = m_offsetPosition;
712 StoreUndoState(UndoType.STATE_PRIM_POSITION); 701 StoreUndoState(UndoType.STATE_PRIM_POSITION);
713 m_offsetPosition = value; 702 m_offsetPosition = value;
714 703
@@ -727,7 +716,12 @@ namespace OpenSim.Region.Framework.Scenes
727 List<ScenePresence> avs = ParentGroup.GetLinkedAvatars(); 716 List<ScenePresence> avs = ParentGroup.GetLinkedAvatars();
728 foreach (ScenePresence av in avs) 717 foreach (ScenePresence av in avs)
729 { 718 {
730 av.SendFullUpdateToAllClients(); 719 if (av.LinkedPrim == m_uuid)
720 {
721 Vector3 offset = (m_offsetPosition - oldpos);
722 av.OffsetPosition += offset;
723 av.SendFullUpdateToAllClients();
724 }
731 } 725 }
732 } 726 }
733 } 727 }
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 5fcd1c2..44c3d12 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -595,11 +595,21 @@ namespace OpenSim.Region.Framework.Scenes
595 595
596 private uint m_parentID; 596 private uint m_parentID;
597 597
598
599 private UUID m_linkedPrim;
600
598 public uint ParentID 601 public uint ParentID
599 { 602 {
600 get { return m_parentID; } 603 get { return m_parentID; }
601 set { m_parentID = value; } 604 set { m_parentID = value; }
602 } 605 }
606
607 public UUID LinkedPrim
608 {
609 get { return m_linkedPrim; }
610 set { m_linkedPrim = value; }
611 }
612
603 public float Health 613 public float Health
604 { 614 {
605 get { return m_health; } 615 get { return m_health; }
@@ -1835,6 +1845,7 @@ namespace OpenSim.Region.Framework.Scenes
1835 1845
1836 m_parentPosition = Vector3.Zero; 1846 m_parentPosition = Vector3.Zero;
1837 m_parentID = 0; 1847 m_parentID = 0;
1848 m_linkedPrim = UUID.Zero;
1838 m_offsetRotation = new Quaternion(0.0f, 0.0f, 0.0f, 1.0f); 1849 m_offsetRotation = new Quaternion(0.0f, 0.0f, 0.0f, 1.0f);
1839 SendFullUpdateToAllClients(); 1850 SendFullUpdateToAllClients();
1840 m_requestedSitTargetID = 0; 1851 m_requestedSitTargetID = 0;
@@ -2422,6 +2433,8 @@ Console.WriteLine("Scripted Sit ofset {0}", m_pos);
2422 m_parentID = m_requestedSitTargetID; 2433 m_parentID = m_requestedSitTargetID;
2423 } 2434 }
2424 2435
2436 m_linkedPrim = part.UUID;
2437
2425 Velocity = Vector3.Zero; 2438 Velocity = Vector3.Zero;
2426 RemoveFromPhysicalScene(); 2439 RemoveFromPhysicalScene();
2427 2440