protected void CheckForSignificantMovement()
{
// Movement updates for agents in neighboring regions are sent directly to clients.
// This value only affects how often agent positions are sent to neighbor regions
// for things such as distance-based update prioritization
const float SIGNIFICANT_MOVEMENT = 2.0f;
if (Util.GetDistanceTo(AbsolutePosition, posLastSignificantMove) > SIGNIFICANT_MOVEMENT)
{
posLastSignificantMove = AbsolutePosition;
m_scene.EventManager.TriggerSignificantClientMovement(m_controllingClient);
}
// 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)
{
m_lastChildAgentUpdatePosition = AbsolutePosition;
m_lastChildAgentUpdateCamPosition = CameraPosition;
ChildAgentDataUpdate cadu = new ChildAgentDataUpdate();
cadu.ActiveGroupID = UUID.Zero.Guid;
cadu.AgentID = UUID.Guid;
cadu.alwaysrun = m_setAlwaysRun;
cadu.AVHeight = m_appearance.AvatarHeight;
Vector3 tempCameraCenter = m_CameraCenter;
cadu.cameraPosition = tempCameraCenter;
cadu.drawdistance = m_DrawDistance;
cadu.GroupAccess = 0;
cadu.Position = 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 = Velocity;
AgentPosition agentpos = new AgentPosition();
agentpos.CopyFrom(cadu);
m_scene.SendOutChildAgentUpdates(agentpos, this);
}
}