From cdbeb8b83b671df1ffb6bf7890c64a27e4a85730 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Wed, 28 Oct 2009 03:21:53 -0700 Subject: Track timestamps when terse updates were last sent for a prim or avatar to avoid floating away forever until a key is pressed (deviates from SL behavior in a hopefully good way) --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 9b11582..e1588ce 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -253,6 +253,7 @@ namespace OpenSim.Region.Framework.Scenes protected Vector3 m_lastVelocity; protected Vector3 m_lastAcceleration; protected Vector3 m_lastAngularVelocity; + protected int m_lastTerseSent; // TODO: Those have to be changed into persistent properties at some later point, // or sit-camera on vehicles will break on sim-crossing. @@ -2395,6 +2396,7 @@ if (m_shape != null) { { const float VELOCITY_TOLERANCE = 0.01f; const float POSITION_TOLERANCE = 0.1f; + const int TIME_MS_TOLERANCE = 3000; if (m_updateFlag == 1) { @@ -2403,7 +2405,8 @@ if (m_shape != null) { Acceleration != m_lastAcceleration || (Velocity - m_lastVelocity).Length() > VELOCITY_TOLERANCE || (RotationalVelocity - m_lastAngularVelocity).Length() > VELOCITY_TOLERANCE || - (OffsetPosition - m_lastPosition).Length() > POSITION_TOLERANCE) + (OffsetPosition - m_lastPosition).Length() > POSITION_TOLERANCE || + Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) { AddTerseUpdateToAllAvatars(); ClearUpdateSchedule(); @@ -2422,6 +2425,7 @@ if (m_shape != null) { m_lastVelocity = Velocity; m_lastAcceleration = Acceleration; m_lastAngularVelocity = RotationalVelocity; + m_lastTerseSent = Environment.TickCount; } } else -- cgit v1.1 From a65c8cdc38f40a54ad4a14ed2e6168fb432c6e51 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Wed, 28 Oct 2009 12:45:40 -0700 Subject: * Reduce the velocity tolerance on sending terse updates to avoid slowly drifting prims/avatars * Added contacts_per_collision to the ODE config section. This allows you to reduce the maximum number of contact points ODE will generate per collision and reduce the size of the array that stores contact structures --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index e1588ce..a99a802 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2394,7 +2394,7 @@ if (m_shape != null) { /// public void SendScheduledUpdates() { - const float VELOCITY_TOLERANCE = 0.01f; + const float VELOCITY_TOLERANCE = 0.0001f; const float POSITION_TOLERANCE = 0.1f; const int TIME_MS_TOLERANCE = 3000; -- cgit v1.1 From b81c829576dd916c0a7bf141919f5e13f025d818 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Wed, 28 Oct 2009 14:13:17 -0700 Subject: * Standalone logins will now go through the sequence of "requested region, default region, any region" before giving up * Hip offset should have been added not subtracted (it's a negative offset). This puts avatar feet closer to the ground * Improved duplicate checking for terse updates. This should reduce bandwidth and walking through walls --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index a99a802..c16c4fe 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2394,18 +2394,19 @@ if (m_shape != null) { /// public void SendScheduledUpdates() { - const float VELOCITY_TOLERANCE = 0.0001f; - const float POSITION_TOLERANCE = 0.1f; + const float ROTATION_TOLERANCE = 0.01f; + const float VELOCITY_TOLERANCE = 0.001f; + const float POSITION_TOLERANCE = 0.05f; const int TIME_MS_TOLERANCE = 3000; if (m_updateFlag == 1) { // Throw away duplicate or insignificant updates - if (RotationOffset != m_lastRotation || - Acceleration != m_lastAcceleration || - (Velocity - m_lastVelocity).Length() > VELOCITY_TOLERANCE || - (RotationalVelocity - m_lastAngularVelocity).Length() > VELOCITY_TOLERANCE || - (OffsetPosition - m_lastPosition).Length() > POSITION_TOLERANCE || + if (!RotationOffset.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) || + !Acceleration.Equals(m_lastAcceleration) || + !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) || + !RotationalVelocity.ApproxEquals(m_lastAngularVelocity, VELOCITY_TOLERANCE) || + !OffsetPosition.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) || Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) { AddTerseUpdateToAllAvatars(); -- cgit v1.1 From 1c9696a9d2665b72ecde45fdcc43c1cde2abad79 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Wed, 28 Oct 2009 15:11:01 -0700 Subject: Always send a time dilation of 1.0 while we debug rubberbanding issues --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index c16c4fe..cf1c394 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2383,7 +2383,7 @@ if (m_shape != null) { //isattachment = ParentGroup.RootPart.IsAttachment; byte[] color = new byte[] {m_color.R, m_color.G, m_color.B, m_color.A}; - remoteClient.SendPrimitiveToClient(new SendPrimitiveData(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, m_shape, + remoteClient.SendPrimitiveToClient(new SendPrimitiveData(m_regionHandle, m_parentGroup.GetTimeDilation(), LocalId, m_shape, lPos, Velocity, Acceleration, RotationOffset, RotationalVelocity, clientFlags, m_uuid, _ownerID, m_text, color, _parentID, m_particleSystem, m_clickAction, (byte)m_material, m_TextureAnimation, IsAttachment, AttachmentPoint,FromItemID, Sound, SoundGain, SoundFlags, SoundRadius, ParentGroup.GetUpdatePriority(remoteClient))); @@ -3785,8 +3785,7 @@ if (m_shape != null) { // Causes this thread to dig into the Client Thread Data. // Remember your locking here! remoteClient.SendPrimTerseUpdate(new SendPrimitiveTerseData(m_regionHandle, - (ushort)(m_parentGroup.GetTimeDilation() * - (float)ushort.MaxValue), LocalId, lPos, + m_parentGroup.GetTimeDilation(), LocalId, lPos, RotationOffset, Velocity, Acceleration, RotationalVelocity, state, FromItemID, OwnerID, (int)AttachmentPoint, null, ParentGroup.GetUpdatePriority(remoteClient))); -- cgit v1.1 From 713287707595061d7ce343db73edf3462d2d29fc Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Thu, 29 Oct 2009 01:46:58 -0700 Subject: * Log progress messages when loading OAR files with a lot of assets * Change the PhysicsCollision callback for objects to send full contact point information. This will be used to calculate the collision plane for avatars * Send the physics engine velocity in terse updates, not the current force being applied to the avatar. This should fix several issues including crouching through the floor and walking through walls --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index cf1c394..3d41666 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1817,7 +1817,7 @@ if (m_shape != null) { } CollisionEventUpdate a = (CollisionEventUpdate)e; - Dictionary collissionswith = a.m_objCollisionList; + Dictionary collissionswith = a.m_objCollisionList; List thisHitColliders = new List(); List endedColliders = new List(); List startedColliders = new List(); -- cgit v1.1 From 67ac9881faf2034facfe92613538938695c2cda9 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Mon, 2 Nov 2009 11:28:35 -0800 Subject: Removing duplicate SceneObjectPart.RotationalVelocity property --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 3d41666..474ffdd 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -683,12 +683,6 @@ namespace OpenSim.Region.Framework.Scenes } } - public Vector3 RotationalVelocity - { - get { return AngularVelocity; } - set { AngularVelocity = value; } - } - /// public Vector3 AngularVelocity { @@ -1552,9 +1546,9 @@ if (m_shape != null) { m_parentGroup.Scene.PhysicsScene.RequestJointDeletion(Name); // FIXME: what if the name changed? // make sure client isn't interpolating the joint proxy object - Velocity = new Vector3(0, 0, 0); - RotationalVelocity = new Vector3(0, 0, 0); - Acceleration = new Vector3(0, 0, 0); + Velocity = Vector3.Zero; + AngularVelocity = Vector3.Zero; + Acceleration = Vector3.Zero; } } } @@ -2384,7 +2378,7 @@ if (m_shape != null) { byte[] color = new byte[] {m_color.R, m_color.G, m_color.B, m_color.A}; remoteClient.SendPrimitiveToClient(new SendPrimitiveData(m_regionHandle, m_parentGroup.GetTimeDilation(), LocalId, m_shape, - lPos, Velocity, Acceleration, RotationOffset, RotationalVelocity, clientFlags, m_uuid, _ownerID, + lPos, Velocity, Acceleration, RotationOffset, AngularVelocity, clientFlags, m_uuid, _ownerID, m_text, color, _parentID, m_particleSystem, m_clickAction, (byte)m_material, m_TextureAnimation, IsAttachment, AttachmentPoint,FromItemID, Sound, SoundGain, SoundFlags, SoundRadius, ParentGroup.GetUpdatePriority(remoteClient))); } @@ -2405,7 +2399,7 @@ if (m_shape != null) { if (!RotationOffset.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) || !Acceleration.Equals(m_lastAcceleration) || !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) || - !RotationalVelocity.ApproxEquals(m_lastAngularVelocity, VELOCITY_TOLERANCE) || + !AngularVelocity.ApproxEquals(m_lastAngularVelocity, VELOCITY_TOLERANCE) || !OffsetPosition.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) || Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) { @@ -2425,7 +2419,7 @@ if (m_shape != null) { m_lastRotation = RotationOffset; m_lastVelocity = Velocity; m_lastAcceleration = Acceleration; - m_lastAngularVelocity = RotationalVelocity; + m_lastAngularVelocity = AngularVelocity; m_lastTerseSent = Environment.TickCount; } } @@ -3787,7 +3781,7 @@ if (m_shape != null) { remoteClient.SendPrimTerseUpdate(new SendPrimitiveTerseData(m_regionHandle, m_parentGroup.GetTimeDilation(), LocalId, lPos, RotationOffset, Velocity, Acceleration, - RotationalVelocity, state, FromItemID, + AngularVelocity, state, FromItemID, OwnerID, (int)AttachmentPoint, null, ParentGroup.GetUpdatePriority(remoteClient))); } -- cgit v1.1 From 0e8b5c7ffa2efa369d4fee9957a36b643cbd7b6b Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Mon, 2 Nov 2009 11:40:57 -0800 Subject: Fixing race conditions in the SceneObjectPart properties --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 109 ++++++++++----------- 1 file changed, 53 insertions(+), 56 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 474ffdd..2bc7f66 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -507,20 +507,17 @@ namespace OpenSim.Region.Framework.Scenes get { // If this is a linkset, we don't want the physics engine mucking up our group position here. - if (PhysActor != null && _parentID == 0) + PhysicsActor actor = PhysActor; + if (actor != null && _parentID == 0) { - m_groupPosition.X = PhysActor.Position.X; - m_groupPosition.Y = PhysActor.Position.Y; - m_groupPosition.Z = PhysActor.Position.Z; + m_groupPosition = actor.Position; } if (IsAttachment) { ScenePresence sp = m_parentGroup.Scene.GetScenePresence(AttachedAvatar); if (sp != null) - { return sp.AbsolutePosition; - } } return m_groupPosition; @@ -531,26 +528,25 @@ namespace OpenSim.Region.Framework.Scenes m_groupPosition = value; - if (PhysActor != null) + PhysicsActor actor = PhysActor; + if (actor != null) { try { // Root prim actually goes at Position if (_parentID == 0) { - PhysActor.Position = value; + actor.Position = value; } else { // To move the child prim in respect to the group position and rotation we have to calculate - Vector3 resultingposition = GetWorldPosition(); - PhysActor.Position = resultingposition; - Quaternion resultingrot = GetWorldRotation(); - PhysActor.Orientation = resultingrot; + actor.Position = GetWorldPosition(); + actor.Orientation = GetWorldRotation(); } // Tell the physics engines that this prim changed. - m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); + m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); } catch (Exception e) { @@ -583,15 +579,14 @@ namespace OpenSim.Region.Framework.Scenes if (ParentGroup != null && !ParentGroup.IsDeleted) { - if (_parentID != 0 && PhysActor != null) + PhysicsActor actor = PhysActor; + if (_parentID != 0 && actor != null) { - Vector3 resultingposition = GetWorldPosition(); - PhysActor.Position = resultingposition; - Quaternion resultingrot = GetWorldRotation(); - PhysActor.Orientation = resultingrot; + actor.Position = GetWorldPosition(); + actor.Orientation = GetWorldRotation(); // Tell the physics engines that this prim changed. - m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); + m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); } } } @@ -602,12 +597,13 @@ namespace OpenSim.Region.Framework.Scenes get { // We don't want the physics engine mucking up the rotations in a linkset - if ((_parentID == 0) && (Shape.PCode != 9 || Shape.State == 0) && (PhysActor != null)) + PhysicsActor actor = PhysActor; + if (_parentID == 0 && (Shape.PCode != 9 || Shape.State == 0) && actor != null) { - if (PhysActor.Orientation.X != 0 || PhysActor.Orientation.Y != 0 - || PhysActor.Orientation.Z != 0 || PhysActor.Orientation.W != 0) + if (actor.Orientation.X != 0f || actor.Orientation.Y != 0f + || actor.Orientation.Z != 0f || actor.Orientation.W != 0f) { - m_rotationOffset = PhysActor.Orientation; + m_rotationOffset = actor.Orientation; } } @@ -619,24 +615,25 @@ namespace OpenSim.Region.Framework.Scenes StoreUndoState(); m_rotationOffset = value; - if (PhysActor != null) + PhysicsActor actor = PhysActor; + if (actor != null) { try { // Root prim gets value directly if (_parentID == 0) { - PhysActor.Orientation = value; - //m_log.Info("[PART]: RO1:" + PhysActor.Orientation.ToString()); + actor.Orientation = value; + //m_log.Info("[PART]: RO1:" + actor.Orientation.ToString()); } else { // Child prim we have to calculate it's world rotationwel Quaternion resultingrotation = GetWorldRotation(); - PhysActor.Orientation = resultingrotation; - //m_log.Info("[PART]: RO2:" + PhysActor.Orientation.ToString()); + actor.Orientation = resultingrotation; + //m_log.Info("[PART]: RO2:" + actor.Orientation.ToString()); } - m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); + m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); //} } catch (Exception ex) @@ -653,16 +650,12 @@ namespace OpenSim.Region.Framework.Scenes { get { - //if (PhysActor.Velocity.X != 0 || PhysActor.Velocity.Y != 0 - //|| PhysActor.Velocity.Z != 0) - //{ - if (PhysActor != null) + PhysicsActor actor = PhysActor; + if (actor != null) { - if (PhysActor.IsPhysical) + if (actor.IsPhysical) { - m_velocity.X = PhysActor.Velocity.X; - m_velocity.Y = PhysActor.Velocity.Y; - m_velocity.Z = PhysActor.Velocity.Z; + m_velocity = actor.Velocity; } } @@ -672,12 +665,14 @@ namespace OpenSim.Region.Framework.Scenes set { m_velocity = value; - if (PhysActor != null) + + PhysicsActor actor = PhysActor; + if (actor != null) { - if (PhysActor.IsPhysical) + if (actor.IsPhysical) { - PhysActor.Velocity = value; - m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); + actor.Velocity = value; + m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); } } } @@ -688,9 +683,10 @@ namespace OpenSim.Region.Framework.Scenes { get { - if ((PhysActor != null) && PhysActor.IsPhysical) + PhysicsActor actor = PhysActor; + if ((actor != null) && actor.IsPhysical) { - m_angularVelocity.FromBytes(PhysActor.RotationalVelocity.GetBytes(), 0); + m_angularVelocity = actor.RotationalVelocity; } return m_angularVelocity; } @@ -710,9 +706,10 @@ namespace OpenSim.Region.Framework.Scenes set { m_description = value; - if (PhysActor != null) + PhysicsActor actor = PhysActor; + if (actor != null) { - PhysActor.SOPDescription = value; + actor.SOPDescription = value; } } } @@ -803,21 +800,23 @@ namespace OpenSim.Region.Framework.Scenes set { StoreUndoState(); -if (m_shape != null) { - m_shape.Scale = value; - - if (PhysActor != null && m_parentGroup != null) + if (m_shape != null) { - if (m_parentGroup.Scene != null) + m_shape.Scale = value; + + PhysicsActor actor = PhysActor; + if (actor != null && m_parentGroup != null) { - if (m_parentGroup.Scene.PhysicsScene != null) + if (m_parentGroup.Scene != null) { - PhysActor.Size = m_shape.Scale; - m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); + if (m_parentGroup.Scene.PhysicsScene != null) + { + actor.Size = m_shape.Scale; + m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(actor); + } } } } -} TriggerScriptChangedEvent(Changed.SCALE); } } @@ -1051,8 +1050,6 @@ if (m_shape != null) { #endregion Public Properties with only Get - - #region Private Methods private uint ApplyMask(uint val, bool set, uint mask) -- cgit v1.1