aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs114
1 files changed, 52 insertions, 62 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 8528edc..0fe9842 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1342,7 +1342,7 @@ namespace OpenSim.Region.Framework.Scenes
1342 public UUID SitTargetAvatar { get; set; } 1342 public UUID SitTargetAvatar { get; set; }
1343 1343
1344 /// <summary> 1344 /// <summary>
1345 /// IDs of all avatars start on this object part. 1345 /// IDs of all avatars sat on this part.
1346 /// </summary> 1346 /// </summary>
1347 /// <remarks> 1347 /// <remarks>
1348 /// We need to track this so that we can stop sat upon prims from being attached. 1348 /// We need to track this so that we can stop sat upon prims from being attached.
@@ -2431,11 +2431,11 @@ namespace OpenSim.Region.Framework.Scenes
2431 public int GetAxisRotation(int axis) 2431 public int GetAxisRotation(int axis)
2432 { 2432 {
2433 //Cannot use ScriptBaseClass constants as no referance to it currently. 2433 //Cannot use ScriptBaseClass constants as no referance to it currently.
2434 if (axis == 2)//STATUS_ROTATE_X 2434 if (axis == (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_X)
2435 return STATUS_ROTATE_X; 2435 return STATUS_ROTATE_X;
2436 if (axis == 4)//STATUS_ROTATE_Y 2436 if (axis == (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Y)
2437 return STATUS_ROTATE_Y; 2437 return STATUS_ROTATE_Y;
2438 if (axis == 8)//STATUS_ROTATE_Z 2438 if (axis == (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Z)
2439 return STATUS_ROTATE_Z; 2439 return STATUS_ROTATE_Z;
2440 2440
2441 return 0; 2441 return 0;
@@ -2470,18 +2470,6 @@ namespace OpenSim.Region.Framework.Scenes
2470 return new Vector3(0, 0, 0); 2470 return new Vector3(0, 0, 0);
2471 2471
2472 return ParentGroup.GetGeometricCenter(); 2472 return ParentGroup.GetGeometricCenter();
2473
2474 /*
2475 PhysicsActor pa = PhysActor;
2476
2477 if (pa != null)
2478 {
2479 Vector3 vtmp = pa.CenterOfMass;
2480 return vtmp;
2481 }
2482 else
2483 return new Vector3(0, 0, 0);
2484 */
2485 } 2473 }
2486 2474
2487 public float GetMass() 2475 public float GetMass()
@@ -2895,11 +2883,14 @@ namespace OpenSim.Region.Framework.Scenes
2895 2883
2896 public void PhysicsOutOfBounds(Vector3 pos) 2884 public void PhysicsOutOfBounds(Vector3 pos)
2897 { 2885 {
2898 m_log.Error("[PHYSICS]: Physical Object went out of bounds."); 2886 // Note: This is only being called on the root prim at this time.
2887
2888 m_log.ErrorFormat(
2889 "[SCENE OBJECT PART]: Physical object {0}, localID {1} went out of bounds at {2} in {3}. Stopping at {4} and making non-physical.",
2890 Name, LocalId, pos, ParentGroup.Scene.Name, AbsolutePosition);
2899 2891
2900 RemFlag(PrimFlags.Physics); 2892 RemFlag(PrimFlags.Physics);
2901 DoPhysicsPropertyUpdate(false, true); 2893 DoPhysicsPropertyUpdate(false, true);
2902 //ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
2903 } 2894 }
2904 2895
2905 public void PhysicsRequestingTerseUpdate() 2896 public void PhysicsRequestingTerseUpdate()
@@ -3322,13 +3313,13 @@ namespace OpenSim.Region.Framework.Scenes
3322 ParentGroup.SetAxisRotation(axis, rotate); 3313 ParentGroup.SetAxisRotation(axis, rotate);
3323 3314
3324 //Cannot use ScriptBaseClass constants as no referance to it currently. 3315 //Cannot use ScriptBaseClass constants as no referance to it currently.
3325 if (axis == 2)//STATUS_ROTATE_X 3316 if ((axis & (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_X) != 0)
3326 STATUS_ROTATE_X = rotate; 3317 STATUS_ROTATE_X = rotate;
3327 3318
3328 if (axis == 4)//STATUS_ROTATE_Y 3319 if ((axis & (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Y) != 0)
3329 STATUS_ROTATE_Y = rotate; 3320 STATUS_ROTATE_Y = rotate;
3330 3321
3331 if (axis == 8)//STATUS_ROTATE_Z 3322 if ((axis & (int)SceneObjectGroup.axisSelect.STATUS_ROTATE_Z) != 0)
3332 STATUS_ROTATE_Z = rotate; 3323 STATUS_ROTATE_Z = rotate;
3333 } 3324 }
3334 3325
@@ -4558,7 +4549,7 @@ namespace OpenSim.Region.Framework.Scenes
4558 if (ParentGroup.RootPart == this) 4549 if (ParentGroup.RootPart == this)
4559 AngularVelocity = new Vector3(0, 0, 0); 4550 AngularVelocity = new Vector3(0, 0, 0);
4560 } 4551 }
4561 else 4552 else if (SetVD != wasVD)
4562 { 4553 {
4563 if (ParentGroup.Scene.CollidablePrims) 4554 if (ParentGroup.Scene.CollidablePrims)
4564 { 4555 {
@@ -4646,9 +4637,9 @@ namespace OpenSim.Region.Framework.Scenes
4646 PhysicsShapeType, 4637 PhysicsShapeType,
4647 m_localId); 4638 m_localId);
4648 } 4639 }
4649 catch (Exception ex) 4640 catch (Exception e)
4650 { 4641 {
4651 m_log.ErrorFormat("[SCENE]: AddToPhysics object {0} failed: {1}", m_uuid, ex.Message); 4642 m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom. e={1}", m_uuid, e);
4652 pa = null; 4643 pa = null;
4653 } 4644 }
4654 4645
@@ -5202,18 +5193,22 @@ namespace OpenSim.Region.Framework.Scenes
5202 /// <param name='avatarId'></param> 5193 /// <param name='avatarId'></param>
5203 protected internal bool AddSittingAvatar(UUID avatarId) 5194 protected internal bool AddSittingAvatar(UUID avatarId)
5204 { 5195 {
5205 if (IsSitTargetSet && SitTargetAvatar == UUID.Zero) 5196 lock (ParentGroup.m_sittingAvatars)
5206 SitTargetAvatar = avatarId; 5197 {
5198 if (IsSitTargetSet && SitTargetAvatar == UUID.Zero)
5199 SitTargetAvatar = avatarId;
5207 5200
5208 HashSet<UUID> sittingAvatars = m_sittingAvatars; 5201 if (m_sittingAvatars == null)
5202 m_sittingAvatars = new HashSet<UUID>();
5209 5203
5210 if (sittingAvatars == null) 5204 if (m_sittingAvatars.Add(avatarId))
5211 sittingAvatars = new HashSet<UUID>(); 5205 {
5206 ParentGroup.m_sittingAvatars.Add(avatarId);
5212 5207
5213 lock (sittingAvatars) 5208 return true;
5214 { 5209 }
5215 m_sittingAvatars = sittingAvatars; 5210
5216 return m_sittingAvatars.Add(avatarId); 5211 return false;
5217 } 5212 }
5218 } 5213 }
5219 5214
@@ -5227,27 +5222,26 @@ namespace OpenSim.Region.Framework.Scenes
5227 /// <param name='avatarId'></param> 5222 /// <param name='avatarId'></param>
5228 protected internal bool RemoveSittingAvatar(UUID avatarId) 5223 protected internal bool RemoveSittingAvatar(UUID avatarId)
5229 { 5224 {
5230 if (SitTargetAvatar == avatarId) 5225 lock (ParentGroup.m_sittingAvatars)
5231 SitTargetAvatar = UUID.Zero; 5226 {
5232 5227 if (SitTargetAvatar == avatarId)
5233 HashSet<UUID> sittingAvatars = m_sittingAvatars; 5228 SitTargetAvatar = UUID.Zero;
5234 5229
5235 // This can occur under a race condition where another thread 5230 if (m_sittingAvatars == null)
5236 if (sittingAvatars == null) 5231 return false;
5237 return false;
5238 5232
5239 lock (sittingAvatars) 5233 if (m_sittingAvatars.Remove(avatarId))
5240 {
5241 if (sittingAvatars.Remove(avatarId))
5242 { 5234 {
5243 if (sittingAvatars.Count == 0) 5235 if (m_sittingAvatars.Count == 0)
5244 m_sittingAvatars = null; 5236 m_sittingAvatars = null;
5245 5237
5238 ParentGroup.m_sittingAvatars.Remove(avatarId);
5239
5246 return true; 5240 return true;
5247 } 5241 }
5248 }
5249 5242
5250 return false; 5243 return false;
5244 }
5251 } 5245 }
5252 5246
5253 /// <summary> 5247 /// <summary>
@@ -5257,16 +5251,12 @@ namespace OpenSim.Region.Framework.Scenes
5257 /// <returns>A hashset of the sitting avatars. Returns null if there are no sitting avatars.</returns> 5251 /// <returns>A hashset of the sitting avatars. Returns null if there are no sitting avatars.</returns>
5258 public HashSet<UUID> GetSittingAvatars() 5252 public HashSet<UUID> GetSittingAvatars()
5259 { 5253 {
5260 HashSet<UUID> sittingAvatars = m_sittingAvatars; 5254 lock (ParentGroup.m_sittingAvatars)
5261
5262 if (sittingAvatars == null)
5263 { 5255 {
5264 return null; 5256 if (m_sittingAvatars == null)
5265 } 5257 return null;
5266 else 5258 else
5267 { 5259 return new HashSet<UUID>(m_sittingAvatars);
5268 lock (sittingAvatars)
5269 return new HashSet<UUID>(sittingAvatars);
5270 } 5260 }
5271 } 5261 }
5272 5262
@@ -5277,13 +5267,13 @@ namespace OpenSim.Region.Framework.Scenes
5277 /// <returns></returns> 5267 /// <returns></returns>
5278 public int GetSittingAvatarsCount() 5268 public int GetSittingAvatarsCount()
5279 { 5269 {
5280 HashSet<UUID> sittingAvatars = m_sittingAvatars; 5270 lock (ParentGroup.m_sittingAvatars)
5281 5271 {
5282 if (sittingAvatars == null) 5272 if (m_sittingAvatars == null)
5283 return 0; 5273 return 0;
5284 5274 else
5285 lock (sittingAvatars) 5275 return m_sittingAvatars.Count;
5286 return sittingAvatars.Count; 5276 }
5287 } 5277 }
5288 } 5278 }
5289} 5279}