GetGroupByPrim() public method

Get a scene object group that contains the prim with the given local id
public GetGroupByPrim ( uint localID ) : SceneObjectGroup
localID uint
return SceneObjectGroup
Ejemplo n.º 1
0
        private double GetPriorityByDistance(IClientAPI client, ISceneEntity entity)
        {
            ScenePresence presence = m_scene.GetScenePresence(client.AgentId);

            if (presence != null)
            {
                // If this is an update for our own avatar give it the highest priority
                if (presence == entity)
                {
                    return(0.0);
                }

                // Use the camera position for local agents and avatar position for remote agents
                Vector3 presencePos = (presence.IsChildAgent) ?
                                      presence.AbsolutePosition :
                                      presence.CameraPosition;

                // Use group position for child prims
                Vector3 entityPos;
                if (entity is SceneObjectPart)
                {
                    entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition;
                }
                else
                {
                    entityPos = entity.AbsolutePosition;
                }

                return(Vector3.DistanceSquared(presencePos, entityPos));
            }

            return(double.NaN);
        }
Ejemplo n.º 2
0
        private double GetPriorityByBestAvatarResponsiveness(IClientAPI client, ISceneEntity entity)
        {
            ScenePresence presence = m_scene.GetScenePresence(client.AgentId);

            if (presence != null)
            {
                // If this is an update for our own avatar give it the highest priority
                if (presence == entity)
                {
                    return(0.0);
                }

                // Use group position for child prims
                Vector3 entityPos = entity.AbsolutePosition;
                if (entity is SceneObjectPart)
                {
                    entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition;
                }
                else
                {
                    entityPos = entity.AbsolutePosition;
                }

                if (!presence.IsChildAgent)
                {
                    if (entity is ScenePresence)
                    {
                        return(1.0);
                    }

                    // Root agent. Use distance from camera and a priority decrease for objects behind us
                    Vector3 camPosition = presence.CameraPosition;
                    Vector3 camAtAxis   = presence.CameraAtAxis;

                    // Distance
                    double priority = Vector3.DistanceSquared(camPosition, entityPos);

                    // Plane equation
                    float d = -Vector3.Dot(camPosition, camAtAxis);
                    float p = Vector3.Dot(camAtAxis, entityPos) + d;
                    if (p < 0.0f)
                    {
                        priority *= 2.0;
                    }

                    if (entity is SceneObjectPart)
                    {
                        PhysicsActor physActor = ((SceneObjectPart)entity).ParentGroup.RootPart.PhysActor;
                        if (physActor == null || !physActor.IsPhysical)
                        {
                            priority += 100;
                        }

                        if (((SceneObjectPart)entity).ParentGroup.RootPart.IsAttachment)
                        {
                            priority = 1.0;
                        }
                    }
                    return(priority);
                }
                else
                {
                    // Child agent. Use the normal distance method
                    Vector3 presencePos = presence.AbsolutePosition;

                    return(Vector3.DistanceSquared(presencePos, entityPos));
                }
            }

            return(double.NaN);
        }