public void OnAgentEnteredRegion(ScenePresence avatar) { Vector3 apos; if (m_ready) { if (avatar.HasSafePosition(out apos)) { // Quantize the position to a 16 x 16 x 3 meter box. This reduces // the number of calls into the wind plugin when the avatar density // is high. apos.X = (((int)apos.X) / 16) * 16; apos.Y = (((int)apos.Y) / 16) * 16; apos.Z = (((int)apos.Z) / 3) * 3; if (m_activeWindPlugin != null && apos != windZpos) { // Ask wind plugin to generate a LL wind array for the specified position windSpeeds = m_activeWindPlugin.WindLLClientArray(apos); windZpos = apos; } avatar.ControllingClient.SendWindData(windSpeeds); } } }
/// <summary> /// Tests to see whether the given avatar can be seen by the client at the given position /// </summary> /// <param name="clientAbsPosition">Position to check from</param> /// <param name="presence">The avatar to check</param> /// <returns></returns> public bool ShowEntityToClient(Vector3 clientAbsPosition, ScenePresence presence) { if (UseCulling == false) { return(true); } Vector3 avpos; if (!presence.HasSafePosition(out avpos)) { return(false); } float drawDistance = m_presence.DrawDistance; if (m_presence.DrawDistance < _MINIMUM_DRAW_DISTANCE) { drawDistance = _MINIMUM_DRAW_DISTANCE; //Smallest distance we will check } return(Vector3.DistanceSquared(clientAbsPosition, avpos) <= drawDistance * drawDistance); }