aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
authorMelanie2012-05-27 19:35:36 +0100
committerMelanie2012-05-27 19:35:36 +0100
commit78e657fd8d911deb0dc1a0eb20a7f2bb2fea1a63 (patch)
treef89d40cb907cd6d8a0df0432c089633c1eb50b8b /OpenSim/Region/Framework/Scenes/ScenePresence.cs
parentMerge branch 'master' into careminster (diff)
parentMerge branch 'ubitwork' into avination (diff)
downloadopensim-SC_OLD-78e657fd8d911deb0dc1a0eb20a7f2bb2fea1a63.zip
opensim-SC_OLD-78e657fd8d911deb0dc1a0eb20a7f2bb2fea1a63.tar.gz
opensim-SC_OLD-78e657fd8d911deb0dc1a0eb20a7f2bb2fea1a63.tar.bz2
opensim-SC_OLD-78e657fd8d911deb0dc1a0eb20a7f2bb2fea1a63.tar.xz
Merge branch 'avination' into careminster
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs133
1 files changed, 82 insertions, 51 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index e0872d0..225d4c9 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2043,7 +2043,7 @@ namespace OpenSim.Region.Framework.Scenes
2043// m_log.DebugFormat("[SCENE PRESENCE]: {0} {1}", SitTargetisSet, SitTargetUnOccupied); 2043// m_log.DebugFormat("[SCENE PRESENCE]: {0} {1}", SitTargetisSet, SitTargetUnOccupied);
2044 2044
2045 if (PhysicsActor != null) 2045 if (PhysicsActor != null)
2046 m_sitAvatarHeight = PhysicsActor.Size.Z; 2046 m_sitAvatarHeight = PhysicsActor.Size.Z * 0.5f;
2047 2047
2048 bool canSit = false; 2048 bool canSit = false;
2049 pos = part.AbsolutePosition + offset; 2049 pos = part.AbsolutePosition + offset;
@@ -4287,6 +4287,7 @@ namespace OpenSim.Region.Framework.Scenes
4287 4287
4288 private void RaiseCollisionScriptEvents(Dictionary<uint, ContactPoint> coldata) 4288 private void RaiseCollisionScriptEvents(Dictionary<uint, ContactPoint> coldata)
4289 { 4289 {
4290 /*
4290 lock(m_collisionEventLock) 4291 lock(m_collisionEventLock)
4291 { 4292 {
4292 if (m_collisionEventFlag) 4293 if (m_collisionEventFlag)
@@ -4296,76 +4297,106 @@ namespace OpenSim.Region.Framework.Scenes
4296 4297
4297 Util.FireAndForget(delegate(object x) 4298 Util.FireAndForget(delegate(object x)
4298 { 4299 {
4300 */
4299 try 4301 try
4300 { 4302 {
4301 List<uint> thisHitColliders = new List<uint>(); 4303 List<uint> thisHitColliders = new List<uint>();
4302 List<uint> endedColliders = new List<uint>(); 4304 List<uint> endedColliders = new List<uint>();
4303 List<uint> startedColliders = new List<uint>(); 4305 List<uint> startedColliders = new List<uint>();
4306 List<CollisionForSoundInfo> soundinfolist = new List<CollisionForSoundInfo>();
4307 CollisionForSoundInfo soundinfo;
4308 ContactPoint curcontact;
4304 4309
4305 foreach (uint localid in coldata.Keys) 4310 if (coldata.Count == 0)
4306 { 4311 {
4307 thisHitColliders.Add(localid); 4312 if (m_lastColliders.Count == 0)
4308 if (!m_lastColliders.Contains(localid)) 4313 return; // nothing to do
4309 { 4314
4310 startedColliders.Add(localid); 4315 foreach (uint localID in m_lastColliders)
4311 }
4312 //m_log.Debug("[SCENE PRESENCE]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString());
4313 }
4314
4315 // calculate things that ended colliding
4316 foreach (uint localID in m_lastColliders)
4317 {
4318 if (!thisHitColliders.Contains(localID))
4319 { 4316 {
4320 endedColliders.Add(localID); 4317 endedColliders.Add(localID);
4321 } 4318 }
4322 } 4319 m_lastColliders.Clear();
4323 //add the items that started colliding this time to the last colliders list.
4324 foreach (uint localID in startedColliders)
4325 {
4326 m_lastColliders.Add(localID);
4327 }
4328 // remove things that ended colliding from the last colliders list
4329 foreach (uint localID in endedColliders)
4330 {
4331 m_lastColliders.Remove(localID);
4332 } 4320 }
4333 4321
4334 // do event notification 4322 else
4335 if (startedColliders.Count > 0)
4336 { 4323 {
4337 CollisionSounds.AvatarCollisionSound(this, startedColliders); 4324 foreach (uint id in coldata.Keys)
4338
4339 ColliderArgs StartCollidingMessage = new ColliderArgs();
4340 List<DetectedObject> colliding = new List<DetectedObject>();
4341 foreach (uint localId in startedColliders)
4342 { 4325 {
4343 if (localId == 0) 4326 thisHitColliders.Add(id);
4344 continue; 4327 if (!m_lastColliders.Contains(id))
4328 {
4329 startedColliders.Add(id);
4330 curcontact = coldata[id];
4331 if (Math.Abs(curcontact.RelativeSpeed) > 0.2)
4332 {
4333 soundinfo = new CollisionForSoundInfo();
4334 soundinfo.colliderID = id;
4335 soundinfo.position = curcontact.Position;
4336 soundinfo.relativeVel = curcontact.RelativeSpeed;
4337 soundinfolist.Add(soundinfo);
4338 }
4339 }
4340 //m_log.Debug("[SCENE PRESENCE]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString());
4341 }
4345 4342
4346 SceneObjectPart obj = Scene.GetSceneObjectPart(localId); 4343 // calculate things that ended colliding
4347 string data = ""; 4344 foreach (uint localID in m_lastColliders)
4348 if (obj != null) 4345 {
4346 if (!thisHitColliders.Contains(localID))
4349 { 4347 {
4350 DetectedObject detobj = new DetectedObject(); 4348 endedColliders.Add(localID);
4351 detobj.keyUUID = obj.UUID;
4352 detobj.nameStr = obj.Name;
4353 detobj.ownerUUID = obj.OwnerID;
4354 detobj.posVector = obj.AbsolutePosition;
4355 detobj.rotQuat = obj.GetWorldRotation();
4356 detobj.velVector = obj.Velocity;
4357 detobj.colliderType = 0;
4358 detobj.groupUUID = obj.GroupID;
4359 colliding.Add(detobj);
4360 } 4349 }
4361 } 4350 }
4351 //add the items that started colliding this time to the last colliders list.
4352 foreach (uint localID in startedColliders)
4353 {
4354 m_lastColliders.Add(localID);
4355 }
4356 // remove things that ended colliding from the last colliders list
4357 foreach (uint localID in endedColliders)
4358 {
4359 m_lastColliders.Remove(localID);
4360 }
4362 4361
4363 if (colliding.Count > 0) 4362 if (soundinfolist.Count > 0)
4363 CollisionSounds.AvatarCollisionSound(this, soundinfolist);
4364
4365 // do event notification
4366 if (startedColliders.Count > 0)
4364 { 4367 {
4365 StartCollidingMessage.Colliders = colliding;
4366 4368
4367 foreach (SceneObjectGroup att in GetAttachments()) 4369 ColliderArgs StartCollidingMessage = new ColliderArgs();
4368 Scene.EventManager.TriggerScriptCollidingStart(att.LocalId, StartCollidingMessage); 4370 List<DetectedObject> colliding = new List<DetectedObject>();
4371 foreach (uint localId in startedColliders)
4372 {
4373 if (localId == 0)
4374 continue;
4375
4376 SceneObjectPart obj = Scene.GetSceneObjectPart(localId);
4377 string data = "";
4378 if (obj != null)
4379 {
4380 DetectedObject detobj = new DetectedObject();
4381 detobj.keyUUID = obj.UUID;
4382 detobj.nameStr = obj.Name;
4383 detobj.ownerUUID = obj.OwnerID;
4384 detobj.posVector = obj.AbsolutePosition;
4385 detobj.rotQuat = obj.GetWorldRotation();
4386 detobj.velVector = obj.Velocity;
4387 detobj.colliderType = 0;
4388 detobj.groupUUID = obj.GroupID;
4389 colliding.Add(detobj);
4390 }
4391 }
4392
4393 if (colliding.Count > 0)
4394 {
4395 StartCollidingMessage.Colliders = colliding;
4396
4397 foreach (SceneObjectGroup att in GetAttachments())
4398 Scene.EventManager.TriggerScriptCollidingStart(att.LocalId, StartCollidingMessage);
4399 }
4369 } 4400 }
4370 } 4401 }
4371 4402
@@ -4446,7 +4477,7 @@ namespace OpenSim.Region.Framework.Scenes
4446 { 4477 {
4447 m_collisionEventFlag = false; 4478 m_collisionEventFlag = false;
4448 } 4479 }
4449 }); 4480// });
4450 } 4481 }
4451 4482
4452 private void TeleportFlagsDebug() { 4483 private void TeleportFlagsDebug() {