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.cs115
1 files changed, 53 insertions, 62 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 8528edc..f037348 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
@@ -4235,6 +4226,7 @@ namespace OpenSim.Region.Framework.Scenes
4235 result.distance = distance2; 4226 result.distance = distance2;
4236 result.HitTF = true; 4227 result.HitTF = true;
4237 result.ipoint = q; 4228 result.ipoint = q;
4229 result.face = i;
4238 //m_log.Info("[FACE]:" + i.ToString()); 4230 //m_log.Info("[FACE]:" + i.ToString());
4239 //m_log.Info("[POINT]: " + q.ToString()); 4231 //m_log.Info("[POINT]: " + q.ToString());
4240 //m_log.Info("[DIST]: " + distance2.ToString()); 4232 //m_log.Info("[DIST]: " + distance2.ToString());
@@ -4558,7 +4550,7 @@ namespace OpenSim.Region.Framework.Scenes
4558 if (ParentGroup.RootPart == this) 4550 if (ParentGroup.RootPart == this)
4559 AngularVelocity = new Vector3(0, 0, 0); 4551 AngularVelocity = new Vector3(0, 0, 0);
4560 } 4552 }
4561 else 4553 else if (SetVD != wasVD)
4562 { 4554 {
4563 if (ParentGroup.Scene.CollidablePrims) 4555 if (ParentGroup.Scene.CollidablePrims)
4564 { 4556 {
@@ -4646,9 +4638,9 @@ namespace OpenSim.Region.Framework.Scenes
4646 PhysicsShapeType, 4638 PhysicsShapeType,
4647 m_localId); 4639 m_localId);
4648 } 4640 }
4649 catch (Exception ex) 4641 catch (Exception e)
4650 { 4642 {
4651 m_log.ErrorFormat("[SCENE]: AddToPhysics object {0} failed: {1}", m_uuid, ex.Message); 4643 m_log.ErrorFormat("[SCENE]: caught exception meshing object {0}. Object set to phantom. e={1}", m_uuid, e);
4652 pa = null; 4644 pa = null;
4653 } 4645 }
4654 4646
@@ -5202,18 +5194,22 @@ namespace OpenSim.Region.Framework.Scenes
5202 /// <param name='avatarId'></param> 5194 /// <param name='avatarId'></param>
5203 protected internal bool AddSittingAvatar(UUID avatarId) 5195 protected internal bool AddSittingAvatar(UUID avatarId)
5204 { 5196 {
5205 if (IsSitTargetSet && SitTargetAvatar == UUID.Zero) 5197 lock (ParentGroup.m_sittingAvatars)
5206 SitTargetAvatar = avatarId; 5198 {
5199 if (IsSitTargetSet && SitTargetAvatar == UUID.Zero)
5200 SitTargetAvatar = avatarId;
5207 5201
5208 HashSet<UUID> sittingAvatars = m_sittingAvatars; 5202 if (m_sittingAvatars == null)
5203 m_sittingAvatars = new HashSet<UUID>();
5209 5204
5210 if (sittingAvatars == null) 5205 if (m_sittingAvatars.Add(avatarId))
5211 sittingAvatars = new HashSet<UUID>(); 5206 {
5207 ParentGroup.m_sittingAvatars.Add(avatarId);
5212 5208
5213 lock (sittingAvatars) 5209 return true;
5214 { 5210 }
5215 m_sittingAvatars = sittingAvatars; 5211
5216 return m_sittingAvatars.Add(avatarId); 5212 return false;
5217 } 5213 }
5218 } 5214 }
5219 5215
@@ -5227,27 +5223,26 @@ namespace OpenSim.Region.Framework.Scenes
5227 /// <param name='avatarId'></param> 5223 /// <param name='avatarId'></param>
5228 protected internal bool RemoveSittingAvatar(UUID avatarId) 5224 protected internal bool RemoveSittingAvatar(UUID avatarId)
5229 { 5225 {
5230 if (SitTargetAvatar == avatarId) 5226 lock (ParentGroup.m_sittingAvatars)
5231 SitTargetAvatar = UUID.Zero; 5227 {
5232 5228 if (SitTargetAvatar == avatarId)
5233 HashSet<UUID> sittingAvatars = m_sittingAvatars; 5229 SitTargetAvatar = UUID.Zero;
5234 5230
5235 // This can occur under a race condition where another thread 5231 if (m_sittingAvatars == null)
5236 if (sittingAvatars == null) 5232 return false;
5237 return false;
5238 5233
5239 lock (sittingAvatars) 5234 if (m_sittingAvatars.Remove(avatarId))
5240 {
5241 if (sittingAvatars.Remove(avatarId))
5242 { 5235 {
5243 if (sittingAvatars.Count == 0) 5236 if (m_sittingAvatars.Count == 0)
5244 m_sittingAvatars = null; 5237 m_sittingAvatars = null;
5245 5238
5239 ParentGroup.m_sittingAvatars.Remove(avatarId);
5240
5246 return true; 5241 return true;
5247 } 5242 }
5248 }
5249 5243
5250 return false; 5244 return false;
5245 }
5251 } 5246 }
5252 5247
5253 /// <summary> 5248 /// <summary>
@@ -5257,16 +5252,12 @@ namespace OpenSim.Region.Framework.Scenes
5257 /// <returns>A hashset of the sitting avatars. Returns null if there are no sitting avatars.</returns> 5252 /// <returns>A hashset of the sitting avatars. Returns null if there are no sitting avatars.</returns>
5258 public HashSet<UUID> GetSittingAvatars() 5253 public HashSet<UUID> GetSittingAvatars()
5259 { 5254 {
5260 HashSet<UUID> sittingAvatars = m_sittingAvatars; 5255 lock (ParentGroup.m_sittingAvatars)
5261
5262 if (sittingAvatars == null)
5263 { 5256 {
5264 return null; 5257 if (m_sittingAvatars == null)
5265 } 5258 return null;
5266 else 5259 else
5267 { 5260 return new HashSet<UUID>(m_sittingAvatars);
5268 lock (sittingAvatars)
5269 return new HashSet<UUID>(sittingAvatars);
5270 } 5261 }
5271 } 5262 }
5272 5263
@@ -5277,13 +5268,13 @@ namespace OpenSim.Region.Framework.Scenes
5277 /// <returns></returns> 5268 /// <returns></returns>
5278 public int GetSittingAvatarsCount() 5269 public int GetSittingAvatarsCount()
5279 { 5270 {
5280 HashSet<UUID> sittingAvatars = m_sittingAvatars; 5271 lock (ParentGroup.m_sittingAvatars)
5281 5272 {
5282 if (sittingAvatars == null) 5273 if (m_sittingAvatars == null)
5283 return 0; 5274 return 0;
5284 5275 else
5285 lock (sittingAvatars) 5276 return m_sittingAvatars.Count;
5286 return sittingAvatars.Count; 5277 }
5287 } 5278 }
5288 } 5279 }
5289} 5280}