aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorTom Grimshaw2010-06-19 10:06:09 -0700
committerTom Grimshaw2010-06-19 10:06:09 -0700
commit49d7d8534ccd037f4690c5ac6aecd66a460960df (patch)
treef3ca2c089c01c31d1e643a645fe26ea072b9f79e /OpenSim/Region/Framework
parentAdd "AvatarHeight/2" to the Home Position when set to avoid having the avatar... (diff)
downloadopensim-SC_OLD-49d7d8534ccd037f4690c5ac6aecd66a460960df.zip
opensim-SC_OLD-49d7d8534ccd037f4690c5ac6aecd66a460960df.tar.gz
opensim-SC_OLD-49d7d8534ccd037f4690c5ac6aecd66a460960df.tar.bz2
opensim-SC_OLD-49d7d8534ccd037f4690c5ac6aecd66a460960df.tar.xz
Allow moving an avatar as part of a linkset using llSetLinkPrimitiveParams. This unlocks an awful lot of poseball-free content, and is a step towards resolving mantis #59.
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs56
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs39
2 files changed, 91 insertions, 4 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index c7d21bb..3e92954 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -110,8 +110,8 @@ namespace OpenSim.Region.Framework.Scenes
110 private long m_minPersistTime = 0; 110 private long m_minPersistTime = 0;
111 private Random m_rand; 111 private Random m_rand;
112 private bool m_suspendUpdates; 112 private bool m_suspendUpdates;
113 113 private System.Threading.ReaderWriterLockSlim m_partsLock = new System.Threading.ReaderWriterLockSlim();
114 private System.Threading.ReaderWriterLockSlim m_partsLock = new System.Threading.ReaderWriterLockSlim(); 114 private List<ScenePresence> m_linkedAvatars = new List<ScenePresence>();
115 115
116 public bool areUpdatesSuspended 116 public bool areUpdatesSuspended
117 { 117 {
@@ -1116,6 +1116,47 @@ namespace OpenSim.Region.Framework.Scenes
1116 } 1116 }
1117 1117
1118 /// <summary> 1118 /// <summary>
1119 /// Add the avatar to this linkset (avatar is sat).
1120 /// </summary>
1121 /// <param name="agentID"></param>
1122 public void AddAvatar(UUID agentID)
1123 {
1124 ScenePresence presence;
1125 if (m_scene.TryGetScenePresence(agentID, out presence))
1126 {
1127 if (!m_linkedAvatars.Contains(presence))
1128 {
1129 m_linkedAvatars.Add(presence);
1130 }
1131 }
1132 }
1133
1134 /// <summary>
1135 /// Delete the avatar from this linkset (avatar is unsat).
1136 /// </summary>
1137 /// <param name="agentID"></param>
1138 public void DeleteAvatar(UUID agentID)
1139 {
1140 ScenePresence presence;
1141 if (m_scene.TryGetScenePresence(agentID, out presence))
1142 {
1143 if (m_linkedAvatars.Contains(presence))
1144 {
1145 m_linkedAvatars.Remove(presence);
1146 }
1147 }
1148 }
1149
1150 /// <summary>
1151 /// Returns the list of linked presences (avatars sat on this group)
1152 /// </summary>
1153 /// <param name="agentID"></param>
1154 public List<ScenePresence> GetLinkedAvatars()
1155 {
1156 return m_linkedAvatars;
1157 }
1158
1159 /// <summary>
1119 /// Attach this scene object to the given avatar. 1160 /// Attach this scene object to the given avatar.
1120 /// </summary> 1161 /// </summary>
1121 /// <param name="agentID"></param> 1162 /// <param name="agentID"></param>
@@ -2974,6 +3015,17 @@ namespace OpenSim.Region.Framework.Scenes
2974 } 3015 }
2975 } 3016 }
2976 3017
3018
3019
3020 /// <summary>
3021 /// Gets the number of parts
3022 /// </summary>
3023 /// <returns></returns>
3024 public int GetPartCount()
3025 {
3026 return Children.Count;
3027 }
3028
2977 /// <summary> 3029 /// <summary>
2978 /// Get the parts of this scene object 3030 /// Get the parts of this scene object
2979 /// </summary> 3031 /// </summary>
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index d4fc6cd..76267ab 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -219,6 +219,7 @@ namespace OpenSim.Region.Framework.Scenes
219 //PauPaw:Proper PID Controler for autopilot************ 219 //PauPaw:Proper PID Controler for autopilot************
220 private bool m_moveToPositionInProgress; 220 private bool m_moveToPositionInProgress;
221 private Vector3 m_moveToPositionTarget; 221 private Vector3 m_moveToPositionTarget;
222 private Quaternion m_offsetRotation = new Quaternion(0.0f, 0.0f, 0.0f, 1.0f);
222 223
223 private bool m_followCamAuto; 224 private bool m_followCamAuto;
224 225
@@ -537,10 +538,39 @@ namespace OpenSim.Region.Framework.Scenes
537 } 538 }
538 } 539 }
539 540
541 public Quaternion OffsetRotation
542 {
543 get { return m_offsetRotation; }
544 set { m_offsetRotation = value; }
545 }
546
540 public Quaternion Rotation 547 public Quaternion Rotation
541 { 548 {
542 get { return m_bodyRot; } 549 get {
543 set { m_bodyRot = value; } 550 if (m_parentID != 0)
551 {
552 if (m_offsetRotation != null)
553 {
554 return m_offsetRotation;
555 }
556 else
557 {
558 return new Quaternion(0.0f, 0.0f, 0.0f, 1.0f);
559 }
560
561 }
562 else
563 {
564 return m_bodyRot;
565 }
566 }
567 set {
568 m_bodyRot = value;
569 if (m_parentID != 0)
570 {
571 m_offsetRotation = new Quaternion(0.0f, 0.0f, 0.0f, 1.0f);
572 }
573 }
544 } 574 }
545 575
546 public Quaternion PreviousRotation 576 public Quaternion PreviousRotation
@@ -1795,6 +1825,7 @@ namespace OpenSim.Region.Framework.Scenes
1795 Vector3 avWorldStandUp = avStandUp + part.GetWorldPosition() + (m_pos * partRot); // + av sit offset! 1825 Vector3 avWorldStandUp = avStandUp + part.GetWorldPosition() + (m_pos * partRot); // + av sit offset!
1796 AbsolutePosition = avWorldStandUp; //KF: Fix stand up. 1826 AbsolutePosition = avWorldStandUp; //KF: Fix stand up.
1797 part.IsOccupied = false; 1827 part.IsOccupied = false;
1828 part.ParentGroup.DeleteAvatar(ControllingClient.AgentId);
1798 } 1829 }
1799 else 1830 else
1800 { 1831 {
@@ -1804,6 +1835,7 @@ namespace OpenSim.Region.Framework.Scenes
1804 1835
1805 m_parentPosition = Vector3.Zero; 1836 m_parentPosition = Vector3.Zero;
1806 m_parentID = 0; 1837 m_parentID = 0;
1838 m_offsetRotation = new Quaternion(0.0f, 0.0f, 0.0f, 1.0f);
1807 SendFullUpdateToAllClients(); 1839 SendFullUpdateToAllClients();
1808 m_requestedSitTargetID = 0; 1840 m_requestedSitTargetID = 0;
1809 1841
@@ -1904,6 +1936,7 @@ namespace OpenSim.Region.Framework.Scenes
1904 part.SetAvatarOnSitTarget(UUID); // set that Av will be on it 1936 part.SetAvatarOnSitTarget(UUID); // set that Av will be on it
1905 offset = new Vector3(avSitOffSet.X, avSitOffSet.Y, avSitOffSet.Z); // change ofset to the scripted one 1937 offset = new Vector3(avSitOffSet.X, avSitOffSet.Y, avSitOffSet.Z); // change ofset to the scripted one
1906 sitOrientation = avSitOrientation; // Change rotatione to the scripted one 1938 sitOrientation = avSitOrientation; // Change rotatione to the scripted one
1939 OffsetRotation = avSitOrientation;
1907 autopilot = false; // Jump direct to scripted llSitPos() 1940 autopilot = false; // Jump direct to scripted llSitPos()
1908 } 1941 }
1909 else 1942 else
@@ -2311,6 +2344,7 @@ namespace OpenSim.Region.Framework.Scenes
2311 m_bodyRot = sitTargetOrient; 2344 m_bodyRot = sitTargetOrient;
2312 m_parentPosition = part.AbsolutePosition; 2345 m_parentPosition = part.AbsolutePosition;
2313 part.IsOccupied = true; 2346 part.IsOccupied = true;
2347 part.ParentGroup.AddAvatar(agentID);
2314Console.WriteLine("Scripted Sit ofset {0}", m_pos); 2348Console.WriteLine("Scripted Sit ofset {0}", m_pos);
2315 } 2349 }
2316 else 2350 else
@@ -2341,6 +2375,7 @@ Console.WriteLine("Scripted Sit ofset {0}", m_pos);
2341 2375
2342 m_parentPosition = part.AbsolutePosition; 2376 m_parentPosition = part.AbsolutePosition;
2343 part.IsOccupied = true; 2377 part.IsOccupied = true;
2378 part.ParentGroup.AddAvatar(agentID);
2344 m_pos = new Vector3(0f, 0f, 0.05f) + // corrections to get Sit Animation 2379 m_pos = new Vector3(0f, 0f, 0.05f) + // corrections to get Sit Animation
2345 (new Vector3(0.0f, 0f, 0.61f) * partIRot) + // located on center 2380 (new Vector3(0.0f, 0f, 0.61f) * partIRot) + // located on center
2346 (new Vector3(0.34f, 0f, 0.0f) * m_bodyRot) + 2381 (new Vector3(0.34f, 0f, 0.0f) * m_bodyRot) +