aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs44
1 files changed, 34 insertions, 10 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index d84c35c..a87bde0 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -248,6 +248,12 @@ namespace OpenSim.Region.Framework.Scenes
248 protected UUID m_uuid; 248 protected UUID m_uuid;
249 protected Vector3 m_velocity; 249 protected Vector3 m_velocity;
250 250
251 protected Vector3 m_lastPosition;
252 protected Quaternion m_lastRotation;
253 protected Vector3 m_lastVelocity;
254 protected Vector3 m_lastAcceleration;
255 protected Vector3 m_lastAngularVelocity;
256
251 // TODO: Those have to be changed into persistent properties at some later point, 257 // TODO: Those have to be changed into persistent properties at some later point,
252 // or sit-camera on vehicles will break on sim-crossing. 258 // or sit-camera on vehicles will break on sim-crossing.
253 private Vector3 m_cameraEyeOffset; 259 private Vector3 m_cameraEyeOffset;
@@ -2387,18 +2393,36 @@ if (m_shape != null) {
2387 /// </summary> 2393 /// </summary>
2388 public void SendScheduledUpdates() 2394 public void SendScheduledUpdates()
2389 { 2395 {
2390 if (m_updateFlag == 1) //some change has been made so update the clients 2396 const float VELOCITY_TOLERANCE = 0.01f;
2397 const float POSITION_TOLERANCE = 10.0f;
2398
2399 if (m_updateFlag == 1)
2391 { 2400 {
2392 AddTerseUpdateToAllAvatars(); 2401 // Throw away duplicate or insignificant updates
2393 ClearUpdateSchedule(); 2402 if (RotationOffset != m_lastRotation ||
2403 Acceleration != m_lastAcceleration ||
2404 (Velocity - m_lastVelocity).Length() > VELOCITY_TOLERANCE ||
2405 (RotationalVelocity - m_lastAngularVelocity).Length() > VELOCITY_TOLERANCE ||
2406 (OffsetPosition - m_lastPosition).Length() > POSITION_TOLERANCE)
2407 {
2408 AddTerseUpdateToAllAvatars();
2409 ClearUpdateSchedule();
2394 2410
2395 // This causes the Scene to 'poll' physical objects every couple of frames 2411 // This causes the Scene to 'poll' physical objects every couple of frames
2396 // bad, so it's been replaced by an event driven method. 2412 // bad, so it's been replaced by an event driven method.
2397 //if ((ObjectFlags & (uint)PrimFlags.Physics) != 0) 2413 //if ((ObjectFlags & (uint)PrimFlags.Physics) != 0)
2398 //{ 2414 //{
2399 // Only send the constant terse updates on physical objects! 2415 // Only send the constant terse updates on physical objects!
2400 //ScheduleTerseUpdate(); 2416 //ScheduleTerseUpdate();
2401 //} 2417 //}
2418
2419 // Update the "last" values
2420 m_lastPosition = OffsetPosition;
2421 m_lastRotation = RotationOffset;
2422 m_lastVelocity = Velocity;
2423 m_lastAcceleration = Acceleration;
2424 m_lastAngularVelocity = RotationalVelocity;
2425 }
2402 } 2426 }
2403 else 2427 else
2404 { 2428 {