diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Prioritizer.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Prioritizer.cs | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs index 272f718..3a3ec2b 100644 --- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs +++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs | |||
@@ -140,6 +140,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
140 | 140 | ||
141 | private double GetPriorityByFrontBack(IClientAPI client, ISceneEntity entity) | 141 | private double GetPriorityByFrontBack(IClientAPI client, ISceneEntity entity) |
142 | { | 142 | { |
143 | if (entity == null) return double.NaN; | ||
143 | ScenePresence presence = m_scene.GetScenePresence(client.AgentId); | 144 | ScenePresence presence = m_scene.GetScenePresence(client.AgentId); |
144 | if (presence != null) | 145 | if (presence != null) |
145 | { | 146 | { |
@@ -150,11 +151,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
150 | // Use group position for child prims | 151 | // Use group position for child prims |
151 | Vector3 entityPos = entity.AbsolutePosition; | 152 | Vector3 entityPos = entity.AbsolutePosition; |
152 | if (entity is SceneObjectPart) | 153 | if (entity is SceneObjectPart) |
153 | { | 154 | { |
154 | // Can't use Scene.GetGroupByPrim() here, since the entity may have been delete from the scene | 155 | SceneObjectGroup group = m_scene.GetGroupByPrim(entity.LocalId); |
155 | // before its scheduled update was triggered | 156 | if (group == null) |
156 | //entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition; | 157 | { |
157 | entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition; | 158 | entityPos = entity.AbsolutePosition; |
159 | } | ||
160 | else | ||
161 | { | ||
162 | entityPos = group.AbsolutePosition; | ||
163 | } | ||
158 | } | 164 | } |
159 | else | 165 | else |
160 | { | 166 | { |
@@ -199,9 +205,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
199 | return 0.0; | 205 | return 0.0; |
200 | 206 | ||
201 | // Use group position for child prims | 207 | // Use group position for child prims |
202 | Vector3 entityPos = entity.AbsolutePosition; | 208 | Vector3 entityPos; |
203 | if (entity is SceneObjectPart) | 209 | if (entity is SceneObjectPart) |
204 | entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition; | 210 | entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition; |
205 | else | 211 | else |
206 | entityPos = entity.AbsolutePosition; | 212 | entityPos = entity.AbsolutePosition; |
207 | 213 | ||
@@ -224,12 +230,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
224 | 230 | ||
225 | if (entity is SceneObjectPart) | 231 | if (entity is SceneObjectPart) |
226 | { | 232 | { |
227 | PhysicsActor physActor = ((SceneObjectPart)entity).ParentGroup.RootPart.PhysActor; | ||
228 | if (physActor == null || !physActor.IsPhysical) | ||
229 | priority += 100; | ||
230 | |||
231 | if (((SceneObjectPart)entity).ParentGroup.RootPart.IsAttachment) | 233 | if (((SceneObjectPart)entity).ParentGroup.RootPart.IsAttachment) |
234 | { | ||
232 | priority = 1.0; | 235 | priority = 1.0; |
236 | } | ||
237 | else | ||
238 | { | ||
239 | PhysicsActor physActor = ((SceneObjectPart)entity).ParentGroup.RootPart.PhysActor; | ||
240 | if (physActor == null || !physActor.IsPhysical) | ||
241 | priority += 100; | ||
242 | } | ||
243 | |||
244 | if (((SceneObjectPart)entity).ParentGroup.RootPart != (SceneObjectPart)entity) | ||
245 | priority +=1; | ||
233 | } | 246 | } |
234 | return priority; | 247 | return priority; |
235 | } | 248 | } |