diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Prioritizer.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Prioritizer.cs | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Prioritizer.cs b/OpenSim/Region/Framework/Scenes/Prioritizer.cs index de3c360..145f9ed 100644 --- a/OpenSim/Region/Framework/Scenes/Prioritizer.cs +++ b/OpenSim/Region/Framework/Scenes/Prioritizer.cs | |||
@@ -134,6 +134,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
134 | 134 | ||
135 | private double GetPriorityByFrontBack(IClientAPI client, ISceneEntity entity) | 135 | private double GetPriorityByFrontBack(IClientAPI client, ISceneEntity entity) |
136 | { | 136 | { |
137 | if (entity == null) return double.NaN; | ||
137 | ScenePresence presence = m_scene.GetScenePresence(client.AgentId); | 138 | ScenePresence presence = m_scene.GetScenePresence(client.AgentId); |
138 | if (presence != null) | 139 | if (presence != null) |
139 | { | 140 | { |
@@ -144,7 +145,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
144 | // Use group position for child prims | 145 | // Use group position for child prims |
145 | Vector3 entityPos = entity.AbsolutePosition; | 146 | Vector3 entityPos = entity.AbsolutePosition; |
146 | if (entity is SceneObjectPart) | 147 | if (entity is SceneObjectPart) |
147 | entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition; | 148 | { |
149 | SceneObjectGroup group = m_scene.GetGroupByPrim(entity.LocalId); | ||
150 | if (group == null) | ||
151 | { | ||
152 | entityPos = entity.AbsolutePosition; | ||
153 | } | ||
154 | else | ||
155 | { | ||
156 | entityPos = group.AbsolutePosition; | ||
157 | } | ||
158 | } | ||
148 | else | 159 | else |
149 | entityPos = entity.AbsolutePosition; | 160 | entityPos = entity.AbsolutePosition; |
150 | 161 | ||
@@ -186,9 +197,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
186 | return 0.0; | 197 | return 0.0; |
187 | 198 | ||
188 | // Use group position for child prims | 199 | // Use group position for child prims |
189 | Vector3 entityPos = entity.AbsolutePosition; | 200 | Vector3 entityPos; |
190 | if (entity is SceneObjectPart) | 201 | if (entity is SceneObjectPart) |
191 | entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition; | 202 | entityPos = ((SceneObjectPart)entity).ParentGroup.AbsolutePosition; |
192 | else | 203 | else |
193 | entityPos = entity.AbsolutePosition; | 204 | entityPos = entity.AbsolutePosition; |
194 | 205 | ||
@@ -211,12 +222,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
211 | 222 | ||
212 | if (entity is SceneObjectPart) | 223 | if (entity is SceneObjectPart) |
213 | { | 224 | { |
214 | PhysicsActor physActor = ((SceneObjectPart)entity).ParentGroup.RootPart.PhysActor; | ||
215 | if (physActor == null || !physActor.IsPhysical) | ||
216 | priority += 100; | ||
217 | |||
218 | if (((SceneObjectPart)entity).ParentGroup.RootPart.IsAttachment) | 225 | if (((SceneObjectPart)entity).ParentGroup.RootPart.IsAttachment) |
226 | { | ||
219 | priority = 1.0; | 227 | priority = 1.0; |
228 | } | ||
229 | else | ||
230 | { | ||
231 | PhysicsActor physActor = ((SceneObjectPart)entity).ParentGroup.RootPart.PhysActor; | ||
232 | if (physActor == null || !physActor.IsPhysical) | ||
233 | priority += 100; | ||
234 | } | ||
235 | |||
236 | if (((SceneObjectPart)entity).ParentGroup.RootPart != (SceneObjectPart)entity) | ||
237 | priority +=1; | ||
220 | } | 238 | } |
221 | return priority; | 239 | return priority; |
222 | } | 240 | } |