diff options
author | Melanie Thielker | 2010-06-22 04:04:59 +0200 |
---|---|---|
committer | Melanie Thielker | 2010-06-22 04:04:59 +0200 |
commit | 962dade15596d0aeff3baba0b0b85c17524766c6 (patch) | |
tree | d385e882124ca01b6eaff1eb3284001b2330f083 /OpenSim/Region/Framework | |
parent | Guard prioritizer agains null values as those produced by a bullet dying (diff) | |
download | opensim-SC_OLD-962dade15596d0aeff3baba0b0b85c17524766c6.zip opensim-SC_OLD-962dade15596d0aeff3baba0b0b85c17524766c6.tar.gz opensim-SC_OLD-962dade15596d0aeff3baba0b0b85c17524766c6.tar.bz2 opensim-SC_OLD-962dade15596d0aeff3baba0b0b85c17524766c6.tar.xz |
Cause collisions with the avatar to be sent to attachments. Currently
ignores collision filter. Physics collisions are still dodgy, so we
don't get the events we should be getting.
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 140 |
1 files changed, 140 insertions, 0 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index a376ab1..654e9ce 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -228,6 +228,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
228 | private int m_updateCount = 0; //KF: Update Anims for a while | 228 | private int m_updateCount = 0; //KF: Update Anims for a while |
229 | private static readonly int UPDATE_COUNT = 10; // how many frames to update for | 229 | private static readonly int UPDATE_COUNT = 10; // how many frames to update for |
230 | private const int NumMovementsBetweenRayCast = 5; | 230 | private const int NumMovementsBetweenRayCast = 5; |
231 | private List<uint> m_lastColliders = new List<uint>(); | ||
231 | 232 | ||
232 | private bool CameraConstraintActive; | 233 | private bool CameraConstraintActive; |
233 | //private int m_moveToPositionStateStatus; | 234 | //private int m_moveToPositionStateStatus; |
@@ -3595,6 +3596,145 @@ Console.WriteLine("Scripted Sit ofset {0}", m_pos); | |||
3595 | } | 3596 | } |
3596 | } | 3597 | } |
3597 | 3598 | ||
3599 | List<uint> thisHitColliders = new List<uint>(); | ||
3600 | List<uint> endedColliders = new List<uint>(); | ||
3601 | List<uint> startedColliders = new List<uint>(); | ||
3602 | |||
3603 | foreach (uint localid in coldata.Keys) | ||
3604 | { | ||
3605 | thisHitColliders.Add(localid); | ||
3606 | if (!m_lastColliders.Contains(localid)) | ||
3607 | { | ||
3608 | startedColliders.Add(localid); | ||
3609 | } | ||
3610 | //m_log.Debug("[SCENE PRESENCE]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString()); | ||
3611 | } | ||
3612 | |||
3613 | // calculate things that ended colliding | ||
3614 | foreach (uint localID in m_lastColliders) | ||
3615 | { | ||
3616 | if (!thisHitColliders.Contains(localID)) | ||
3617 | { | ||
3618 | endedColliders.Add(localID); | ||
3619 | } | ||
3620 | } | ||
3621 | //add the items that started colliding this time to the last colliders list. | ||
3622 | foreach (uint localID in startedColliders) | ||
3623 | { | ||
3624 | m_lastColliders.Add(localID); | ||
3625 | } | ||
3626 | // remove things that ended colliding from the last colliders list | ||
3627 | foreach (uint localID in endedColliders) | ||
3628 | { | ||
3629 | m_lastColliders.Remove(localID); | ||
3630 | } | ||
3631 | |||
3632 | // do event notification | ||
3633 | if (startedColliders.Count > 0) | ||
3634 | { | ||
3635 | ColliderArgs StartCollidingMessage = new ColliderArgs(); | ||
3636 | List<DetectedObject> colliding = new List<DetectedObject>(); | ||
3637 | foreach (uint localId in startedColliders) | ||
3638 | { | ||
3639 | if (localId == 0) | ||
3640 | continue; | ||
3641 | |||
3642 | SceneObjectPart obj = Scene.GetSceneObjectPart(localId); | ||
3643 | string data = ""; | ||
3644 | if (obj != null) | ||
3645 | { | ||
3646 | DetectedObject detobj = new DetectedObject(); | ||
3647 | detobj.keyUUID = obj.UUID; | ||
3648 | detobj.nameStr = obj.Name; | ||
3649 | detobj.ownerUUID = obj.OwnerID; | ||
3650 | detobj.posVector = obj.AbsolutePosition; | ||
3651 | detobj.rotQuat = obj.GetWorldRotation(); | ||
3652 | detobj.velVector = obj.Velocity; | ||
3653 | detobj.colliderType = 0; | ||
3654 | detobj.groupUUID = obj.GroupID; | ||
3655 | colliding.Add(detobj); | ||
3656 | } | ||
3657 | } | ||
3658 | |||
3659 | if (colliding.Count > 0) | ||
3660 | { | ||
3661 | StartCollidingMessage.Colliders = colliding; | ||
3662 | |||
3663 | foreach (SceneObjectGroup att in Attachments) | ||
3664 | Scene.EventManager.TriggerScriptCollidingStart(att.LocalId, StartCollidingMessage); | ||
3665 | } | ||
3666 | } | ||
3667 | |||
3668 | if (endedColliders.Count > 0) | ||
3669 | { | ||
3670 | ColliderArgs EndCollidingMessage = new ColliderArgs(); | ||
3671 | List<DetectedObject> colliding = new List<DetectedObject>(); | ||
3672 | foreach (uint localId in endedColliders) | ||
3673 | { | ||
3674 | if (localId == 0) | ||
3675 | continue; | ||
3676 | |||
3677 | SceneObjectPart obj = Scene.GetSceneObjectPart(localId); | ||
3678 | string data = ""; | ||
3679 | if (obj != null) | ||
3680 | { | ||
3681 | DetectedObject detobj = new DetectedObject(); | ||
3682 | detobj.keyUUID = obj.UUID; | ||
3683 | detobj.nameStr = obj.Name; | ||
3684 | detobj.ownerUUID = obj.OwnerID; | ||
3685 | detobj.posVector = obj.AbsolutePosition; | ||
3686 | detobj.rotQuat = obj.GetWorldRotation(); | ||
3687 | detobj.velVector = obj.Velocity; | ||
3688 | detobj.colliderType = 0; | ||
3689 | detobj.groupUUID = obj.GroupID; | ||
3690 | colliding.Add(detobj); | ||
3691 | } | ||
3692 | } | ||
3693 | |||
3694 | if (colliding.Count > 0) | ||
3695 | { | ||
3696 | EndCollidingMessage.Colliders = colliding; | ||
3697 | |||
3698 | foreach (SceneObjectGroup att in Attachments) | ||
3699 | Scene.EventManager.TriggerScriptCollidingEnd(att.LocalId, EndCollidingMessage); | ||
3700 | } | ||
3701 | } | ||
3702 | |||
3703 | if (thisHitColliders.Count > 0) | ||
3704 | { | ||
3705 | ColliderArgs CollidingMessage = new ColliderArgs(); | ||
3706 | List<DetectedObject> colliding = new List<DetectedObject>(); | ||
3707 | foreach (uint localId in thisHitColliders) | ||
3708 | { | ||
3709 | if (localId == 0) | ||
3710 | continue; | ||
3711 | |||
3712 | SceneObjectPart obj = Scene.GetSceneObjectPart(localId); | ||
3713 | string data = ""; | ||
3714 | if (obj != null) | ||
3715 | { | ||
3716 | DetectedObject detobj = new DetectedObject(); | ||
3717 | detobj.keyUUID = obj.UUID; | ||
3718 | detobj.nameStr = obj.Name; | ||
3719 | detobj.ownerUUID = obj.OwnerID; | ||
3720 | detobj.posVector = obj.AbsolutePosition; | ||
3721 | detobj.rotQuat = obj.GetWorldRotation(); | ||
3722 | detobj.velVector = obj.Velocity; | ||
3723 | detobj.colliderType = 0; | ||
3724 | detobj.groupUUID = obj.GroupID; | ||
3725 | colliding.Add(detobj); | ||
3726 | } | ||
3727 | } | ||
3728 | |||
3729 | if (colliding.Count > 0) | ||
3730 | { | ||
3731 | CollidingMessage.Colliders = colliding; | ||
3732 | |||
3733 | foreach (SceneObjectGroup att in Attachments) | ||
3734 | Scene.EventManager.TriggerScriptColliding(att.LocalId, CollidingMessage); | ||
3735 | } | ||
3736 | } | ||
3737 | |||
3598 | if (m_invulnerable) | 3738 | if (m_invulnerable) |
3599 | return; | 3739 | return; |
3600 | 3740 | ||