public override void Update()
{
const float ROTATION_TOLERANCE = 0.01f;
const float VELOCITY_TOLERANCE = 0.001f;
const float POSITION_TOLERANCE = 0.05f;
//const int TIME_MS_TOLERANCE = 3000;
SendPrimUpdates();
if (m_isChildAgent == false)
{
// PhysicsActor actor = m_physicsActor;
// NOTE: Velocity is not the same as m_velocity. Velocity will attempt to
// grab the latest PhysicsActor velocity, whereas m_velocity is often
// storing a requested force instead of an actual traveling velocity
// Throw away duplicate or insignificant updates
if (!m_bodyRot.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) ||
!Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) ||
!m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE))
//Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE)
{
SendTerseUpdateToAllClients();
// Update the "last" values
m_lastPosition = m_pos;
m_lastRotation = m_bodyRot;
m_lastVelocity = Velocity;
//m_lastTerseSent = Environment.TickCount;
}
// followed suggestion from mic bowman. reversed the two lines below.
if (m_parentID == 0 && m_physicsActor != null || m_parentID != 0) // Check that we have a physics actor or we're sitting on something
CheckForBorderCrossing();
CheckForSignificantMovement(); // sends update to the modules.
}
}