diff options
author | UbitUmarov | 2017-07-13 20:21:18 +0100 |
---|---|---|
committer | UbitUmarov | 2017-07-13 20:21:18 +0100 |
commit | 8b16131206818329e973faec3a9861fca37f0073 (patch) | |
tree | d2fa5fde6441f83e2396bd5893f9c6fd368f5cdd /OpenSim/Region/Framework/Scenes | |
parent | update libomv fixing EnUsCulture (diff) | |
download | opensim-SC_OLD-8b16131206818329e973faec3a9861fca37f0073.zip opensim-SC_OLD-8b16131206818329e973faec3a9861fca37f0073.tar.gz opensim-SC_OLD-8b16131206818329e973faec3a9861fca37f0073.tar.bz2 opensim-SC_OLD-8b16131206818329e973faec3a9861fca37f0073.tar.xz |
add Util.GetTimeStamp() that returns the stamp in seconds; use it on ubOde; separed land collsions dispatch from the others...
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 104 |
1 files changed, 76 insertions, 28 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 2e16663..2384143 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -329,7 +329,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
329 | private byte[] m_TextureAnimation; | 329 | private byte[] m_TextureAnimation; |
330 | private byte m_clickAction; | 330 | private byte m_clickAction; |
331 | private Color m_color = Color.Black; | 331 | private Color m_color = Color.Black; |
332 | private readonly List<uint> m_lastColliders = new List<uint>(); | 332 | private List<uint> m_lastColliders = new List<uint>(); |
333 | private bool m_lastLandCollide; | ||
333 | private int m_linkNum; | 334 | private int m_linkNum; |
334 | 335 | ||
335 | private int m_scriptAccessPin; | 336 | private int m_scriptAccessPin; |
@@ -2789,12 +2790,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2789 | { | 2790 | { |
2790 | ColliderArgs colliderArgs = new ColliderArgs(); | 2791 | ColliderArgs colliderArgs = new ColliderArgs(); |
2791 | List<DetectedObject> colliding = new List<DetectedObject>(); | 2792 | List<DetectedObject> colliding = new List<DetectedObject>(); |
2793 | Scene parentScene = ParentGroup.Scene; | ||
2792 | foreach (uint localId in colliders) | 2794 | foreach (uint localId in colliders) |
2793 | { | 2795 | { |
2794 | if (localId == 0) | 2796 | if (localId == 0) |
2795 | continue; | 2797 | continue; |
2796 | 2798 | ||
2797 | SceneObjectPart obj = ParentGroup.Scene.GetSceneObjectPart(localId); | 2799 | SceneObjectPart obj = parentScene.GetSceneObjectPart(localId); |
2798 | if (obj != null) | 2800 | if (obj != null) |
2799 | { | 2801 | { |
2800 | if (!dest.CollisionFilteredOut(obj.UUID, obj.Name)) | 2802 | if (!dest.CollisionFilteredOut(obj.UUID, obj.Name)) |
@@ -2802,7 +2804,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2802 | } | 2804 | } |
2803 | else | 2805 | else |
2804 | { | 2806 | { |
2805 | ScenePresence av = ParentGroup.Scene.GetScenePresence(localId); | 2807 | ScenePresence av = parentScene.GetScenePresence(localId); |
2806 | if (av != null && (!av.IsChildAgent)) | 2808 | if (av != null && (!av.IsChildAgent)) |
2807 | { | 2809 | { |
2808 | if (!dest.CollisionFilteredOut(av.UUID, av.Name)) | 2810 | if (!dest.CollisionFilteredOut(av.UUID, av.Name)) |
@@ -2879,6 +2881,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2879 | return; | 2881 | return; |
2880 | 2882 | ||
2881 | // this a thread from physics ( heartbeat ) | 2883 | // this a thread from physics ( heartbeat ) |
2884 | bool thisHitLand = false; | ||
2885 | bool startLand = false; | ||
2886 | bool endedLand = false; | ||
2882 | 2887 | ||
2883 | CollisionEventUpdate a = (CollisionEventUpdate)e; | 2888 | CollisionEventUpdate a = (CollisionEventUpdate)e; |
2884 | Dictionary<uint, ContactPoint> collissionswith = a.m_objCollisionList; | 2889 | Dictionary<uint, ContactPoint> collissionswith = a.m_objCollisionList; |
@@ -2888,13 +2893,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
2888 | 2893 | ||
2889 | if (collissionswith.Count == 0) | 2894 | if (collissionswith.Count == 0) |
2890 | { | 2895 | { |
2891 | if (m_lastColliders.Count == 0) | 2896 | if (m_lastColliders.Count == 0 && !m_lastLandCollide) |
2892 | return; // nothing to do | 2897 | return; // nothing to do |
2893 | 2898 | ||
2899 | endedLand = m_lastLandCollide; | ||
2900 | m_lastLandCollide = false; | ||
2901 | |||
2894 | foreach (uint localID in m_lastColliders) | 2902 | foreach (uint localID in m_lastColliders) |
2895 | { | 2903 | { |
2896 | endedColliders.Add(localID); | 2904 | endedColliders.Add(localID); |
2897 | } | 2905 | } |
2906 | |||
2898 | m_lastColliders.Clear(); | 2907 | m_lastColliders.Clear(); |
2899 | } | 2908 | } |
2900 | else | 2909 | else |
@@ -2910,19 +2919,39 @@ namespace OpenSim.Region.Framework.Scenes | |||
2910 | 2919 | ||
2911 | foreach (uint id in collissionswith.Keys) | 2920 | foreach (uint id in collissionswith.Keys) |
2912 | { | 2921 | { |
2913 | thisHitColliders.Add(id); | 2922 | if(id == 0) |
2914 | if (!m_lastColliders.Contains(id)) | ||
2915 | { | 2923 | { |
2916 | startedColliders.Add(id); | 2924 | thisHitLand = true; |
2917 | 2925 | if (!m_lastLandCollide) | |
2918 | curcontact = collissionswith[id]; | 2926 | { |
2919 | if (Math.Abs(curcontact.RelativeSpeed) > 0.2) | 2927 | startLand = true; |
2928 | curcontact = collissionswith[id]; | ||
2929 | if (Math.Abs(curcontact.RelativeSpeed) > 0.2) | ||
2930 | { | ||
2931 | soundinfo = new CollisionForSoundInfo(); | ||
2932 | soundinfo.colliderID = id; | ||
2933 | soundinfo.position = curcontact.Position; | ||
2934 | soundinfo.relativeVel = curcontact.RelativeSpeed; | ||
2935 | soundinfolist.Add(soundinfo); | ||
2936 | } | ||
2937 | } | ||
2938 | } | ||
2939 | else | ||
2940 | { | ||
2941 | thisHitColliders.Add(id); | ||
2942 | if (!m_lastColliders.Contains(id)) | ||
2920 | { | 2943 | { |
2921 | soundinfo = new CollisionForSoundInfo(); | 2944 | startedColliders.Add(id); |
2922 | soundinfo.colliderID = id; | 2945 | |
2923 | soundinfo.position = curcontact.Position; | 2946 | curcontact = collissionswith[id]; |
2924 | soundinfo.relativeVel = curcontact.RelativeSpeed; | 2947 | if (Math.Abs(curcontact.RelativeSpeed) > 0.2) |
2925 | soundinfolist.Add(soundinfo); | 2948 | { |
2949 | soundinfo = new CollisionForSoundInfo(); | ||
2950 | soundinfo.colliderID = id; | ||
2951 | soundinfo.position = curcontact.Position; | ||
2952 | soundinfo.relativeVel = curcontact.RelativeSpeed; | ||
2953 | soundinfolist.Add(soundinfo); | ||
2954 | } | ||
2926 | } | 2955 | } |
2927 | } | 2956 | } |
2928 | } | 2957 | } |
@@ -2931,9 +2960,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
2931 | { | 2960 | { |
2932 | foreach (uint id in collissionswith.Keys) | 2961 | foreach (uint id in collissionswith.Keys) |
2933 | { | 2962 | { |
2934 | thisHitColliders.Add(id); | 2963 | if(id == 0) |
2935 | if (!m_lastColliders.Contains(id)) | 2964 | { |
2936 | startedColliders.Add(id); | 2965 | thisHitLand = true; |
2966 | if (!m_lastLandCollide) | ||
2967 | startLand = true; | ||
2968 | } | ||
2969 | else | ||
2970 | { | ||
2971 | thisHitColliders.Add(id); | ||
2972 | if (!m_lastColliders.Contains(id)) | ||
2973 | startedColliders.Add(id); | ||
2974 | } | ||
2937 | } | 2975 | } |
2938 | } | 2976 | } |
2939 | 2977 | ||
@@ -2952,22 +2990,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
2952 | foreach (uint localID in endedColliders) | 2990 | foreach (uint localID in endedColliders) |
2953 | m_lastColliders.Remove(localID); | 2991 | m_lastColliders.Remove(localID); |
2954 | 2992 | ||
2993 | if(m_lastLandCollide && !thisHitLand) | ||
2994 | endedLand = true; | ||
2995 | |||
2996 | m_lastLandCollide = thisHitLand; | ||
2997 | |||
2955 | // play sounds. | 2998 | // play sounds. |
2956 | if (soundinfolist.Count > 0) | 2999 | if (soundinfolist.Count > 0) |
2957 | CollisionSounds.PartCollisionSound(this, soundinfolist); | 3000 | CollisionSounds.PartCollisionSound(this, soundinfolist); |
2958 | } | 3001 | } |
3002 | |||
3003 | EventManager eventmanager = ParentGroup.Scene.EventManager; | ||
2959 | 3004 | ||
2960 | SendCollisionEvent(scriptEvents.collision_start, startedColliders, ParentGroup.Scene.EventManager.TriggerScriptCollidingStart); | 3005 | SendCollisionEvent(scriptEvents.collision_start, startedColliders, eventmanager.TriggerScriptCollidingStart); |
2961 | if (!VolumeDetectActive) | 3006 | if (!VolumeDetectActive) |
2962 | SendCollisionEvent(scriptEvents.collision , m_lastColliders , ParentGroup.Scene.EventManager.TriggerScriptColliding); | 3007 | SendCollisionEvent(scriptEvents.collision , m_lastColliders , eventmanager.TriggerScriptColliding); |
2963 | SendCollisionEvent(scriptEvents.collision_end , endedColliders , ParentGroup.Scene.EventManager.TriggerScriptCollidingEnd); | 3008 | SendCollisionEvent(scriptEvents.collision_end , endedColliders , eventmanager.TriggerScriptCollidingEnd); |
2964 | 3009 | ||
2965 | if (startedColliders.Contains(0)) | 3010 | if (!VolumeDetectActive) |
2966 | SendLandCollisionEvent(scriptEvents.land_collision_start, ParentGroup.Scene.EventManager.TriggerScriptLandCollidingStart); | 3011 | { |
2967 | if (m_lastColliders.Contains(0)) | 3012 | if (startLand) |
2968 | SendLandCollisionEvent(scriptEvents.land_collision, ParentGroup.Scene.EventManager.TriggerScriptLandColliding); | 3013 | SendLandCollisionEvent(scriptEvents.land_collision_start, eventmanager.TriggerScriptLandCollidingStart); |
2969 | if (endedColliders.Contains(0)) | 3014 | if (m_lastLandCollide) |
2970 | SendLandCollisionEvent(scriptEvents.land_collision_end, ParentGroup.Scene.EventManager.TriggerScriptLandCollidingEnd); | 3015 | SendLandCollisionEvent(scriptEvents.land_collision, eventmanager.TriggerScriptLandColliding); |
3016 | if (endedLand) | ||
3017 | SendLandCollisionEvent(scriptEvents.land_collision_end, eventmanager.TriggerScriptLandCollidingEnd); | ||
3018 | } | ||
2971 | } | 3019 | } |
2972 | 3020 | ||
2973 | // The Collision sounds code calls this | 3021 | // The Collision sounds code calls this |
@@ -2986,7 +3034,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2986 | volume = 0; | 3034 | volume = 0; |
2987 | 3035 | ||
2988 | int now = Util.EnvironmentTickCount(); | 3036 | int now = Util.EnvironmentTickCount(); |
2989 | if(Util.EnvironmentTickCountSubtract(now,LastColSoundSentTime) <200) | 3037 | if(Util.EnvironmentTickCountSubtract(now, LastColSoundSentTime) < 200) |
2990 | return; | 3038 | return; |
2991 | 3039 | ||
2992 | LastColSoundSentTime = now; | 3040 | LastColSoundSentTime = now; |