예제 #1
0
        /// <summary>
        /// This checks for a significant movement and sends a courselocationchange update
        /// </summary>
        protected void CheckForSignificantMovement()
        {
            if (Util.GetDistanceTo(AbsolutePosition, posLastSignificantMove) > 0.5)
            {
                posLastSignificantMove = AbsolutePosition;
                m_scene.EventManager.TriggerSignificantClientMovement(m_controllingClient);
                m_scene.NotifyMyCoarseLocationChange();
            }

            // Minimum Draw distance is 64 meters, the Radius of the draw distance sphere is 32m
            if (Util.GetDistanceTo(AbsolutePosition, m_lastChildAgentUpdatePosition) >= Scene.ChildReprioritizationDistance ||
                Util.GetDistanceTo(CameraPosition, m_lastChildAgentUpdateCamPosition) >= Scene.ChildReprioritizationDistance)
            {
                ChildAgentDataUpdate cadu = new ChildAgentDataUpdate();
                cadu.ActiveGroupID = UUID.Zero.Guid;
                cadu.AgentID = UUID.Guid;
                cadu.alwaysrun = m_setAlwaysRun;
                cadu.AVHeight = m_avHeight;
                sLLVector3 tempCameraCenter = new sLLVector3(new Vector3(m_CameraCenter.X, m_CameraCenter.Y, m_CameraCenter.Z));
                cadu.cameraPosition = tempCameraCenter;
                cadu.drawdistance = m_DrawDistance;
                if (m_scene.Permissions.IsGod(new UUID(cadu.AgentID)))
                    cadu.godlevel = m_godlevel;
                cadu.GroupAccess = 0;
                cadu.Position = new sLLVector3(AbsolutePosition);
                cadu.regionHandle = m_rootRegionHandle;
                float multiplier = 1;
                int innacurateNeighbors = m_scene.GetInaccurateNeighborCount();
                if (innacurateNeighbors != 0)
                {
                    multiplier = 1f / (float)innacurateNeighbors;
                }
                if (multiplier <= 0f)
                {
                    multiplier = 0.25f;
                }

                //m_log.Info("[NeighborThrottle]: " + m_scene.GetInaccurateNeighborCount().ToString() + " - m: " + multiplier.ToString());
                cadu.throttles = ControllingClient.GetThrottlesPacked(multiplier);
                cadu.Velocity = new sLLVector3(Velocity);

                AgentPosition agentpos = new AgentPosition();
                agentpos.CopyFrom(cadu);

                m_scene.SendOutChildAgentUpdates(agentpos, this);

                m_lastChildAgentUpdatePosition = AbsolutePosition;
                m_lastChildAgentUpdateCamPosition = CameraPosition;
            }
        }
예제 #2
0
        public void SendChildAgentUpdate()
        {
            Vector3 pos = AbsolutePosition;
            m_LastChildAgentUpdatePosition.X = pos.X;
            m_LastChildAgentUpdatePosition.Y = pos.Y;
            m_LastChildAgentUpdatePosition.Z = pos.Z;

            ChildAgentDataUpdate cadu = new ChildAgentDataUpdate();
            cadu.ActiveGroupID = UUID.Zero.Guid;
            cadu.AgentID = UUID.Guid;
            cadu.alwaysrun = m_setAlwaysRun;
            cadu.AVHeight = m_avHeight;
            sLLVector3 tempCameraCenter = new sLLVector3(new Vector3(m_CameraCenter.X, m_CameraCenter.Y, m_CameraCenter.Z));
            cadu.cameraPosition = tempCameraCenter;
            cadu.drawdistance = m_DrawDistance;
            if (!this.IsBot)    // bots don't need IsGod checks
                if (m_scene.Permissions.IsGod(new UUID(cadu.AgentID)))
                    cadu.godlevel = m_godlevel;
            cadu.GroupAccess = 0;
            cadu.Position = new sLLVector3(pos);
            cadu.regionHandle = m_scene.RegionInfo.RegionHandle;

            float multiplier = CalculateNeighborBandwidthMultiplier();
            //m_log.Info("[NeighborThrottle]: " + m_scene.GetInaccurateNeighborCount().ToString() + " - m: " + multiplier.ToString());
            cadu.throttles = ControllingClient.GetThrottlesPacked(multiplier);
            cadu.Velocity = new sLLVector3(Velocity);

            AgentPosition agentpos = new AgentPosition();
            agentpos.CopyFrom(cadu);

            m_scene.SendOutChildAgentUpdates(agentpos, this);
        }