diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 7e3adb9..ba3aaae 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -279,8 +279,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
279 | private bool MouseDown = false; | 279 | private bool MouseDown = false; |
280 | public Vector3 lastKnownAllowedPosition; | 280 | public Vector3 lastKnownAllowedPosition; |
281 | public bool sentMessageAboutRestrictedParcelFlyingDown; | 281 | public bool sentMessageAboutRestrictedParcelFlyingDown; |
282 | |||
282 | public Vector4 CollisionPlane = Vector4.UnitW; | 283 | public Vector4 CollisionPlane = Vector4.UnitW; |
283 | 284 | ||
285 | public Vector4 m_lastCollisionPlane = Vector4.UnitW; | ||
286 | private byte m_lastState; | ||
284 | private Vector3 m_lastPosition; | 287 | private Vector3 m_lastPosition; |
285 | private Quaternion m_lastRotation; | 288 | private Quaternion m_lastRotation; |
286 | private Vector3 m_lastVelocity; | 289 | private Vector3 m_lastVelocity; |
@@ -2818,16 +2821,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2818 | CameraAtAxis = agentData.CameraAtAxis; | 2821 | CameraAtAxis = agentData.CameraAtAxis; |
2819 | CameraLeftAxis = agentData.CameraLeftAxis; | 2822 | CameraLeftAxis = agentData.CameraLeftAxis; |
2820 | CameraUpAxis = agentData.CameraUpAxis; | 2823 | CameraUpAxis = agentData.CameraUpAxis; |
2821 | Quaternion camRot = Util.Axes2Rot(CameraAtAxis, CameraLeftAxis, CameraUpAxis); | ||
2822 | CameraRotation = camRot; | ||
2823 | |||
2824 | // The Agent's Draw distance setting | ||
2825 | // When we get to the point of re-computing neighbors everytime this | ||
2826 | // changes, then start using the agent's drawdistance rather than the | ||
2827 | // region's draw distance. | ||
2828 | |||
2829 | DrawDistance = agentData.Far; | 2824 | DrawDistance = agentData.Far; |
2830 | 2825 | ||
2826 | CameraAtAxis.Normalize(); | ||
2827 | CameraLeftAxis.Normalize(); | ||
2828 | CameraUpAxis.Normalize(); | ||
2829 | Quaternion camRot = Util.Axes2Rot(CameraAtAxis, CameraLeftAxis, CameraUpAxis); | ||
2830 | CameraRotation = camRot; | ||
2831 | 2831 | ||
2832 | // Check if Client has camera in 'follow cam' or 'build' mode. | 2832 | // Check if Client has camera in 'follow cam' or 'build' mode. |
2833 | // Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation); | 2833 | // Vector3 camdif = (Vector3.One * Rotation - Vector3.One * CameraRotation); |
@@ -3789,29 +3789,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
3789 | 3789 | ||
3790 | // Send terse position update if not sitting and position, velocity, or rotation | 3790 | // Send terse position update if not sitting and position, velocity, or rotation |
3791 | // has changed significantly from last sent update | 3791 | // has changed significantly from last sent update |
3792 | if (!IsSatOnObject && ( | ||
3793 | !Rotation.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) | ||
3794 | || !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) | ||
3795 | || !m_pos.ApproxEquals(m_lastPosition, POSITION_LARGETOLERANCE) | ||
3796 | // if velocity is zero and it wasn't zero last time, send the update | ||
3797 | || (Velocity == Vector3.Zero && m_lastVelocity != Vector3.Zero) | ||
3798 | // if position has moved just a little and velocity is very low, send the update | ||
3799 | || (!m_pos.ApproxEquals(m_lastPosition, POSITION_SMALLTOLERANCE) && Velocity.LengthSquared() < LOWVELOCITYSQ ) | ||
3800 | ) ) | ||
3801 | { | ||
3802 | /* | ||
3803 | if (!IsSatOnObject) | 3792 | if (!IsSatOnObject) |
3804 | { | 3793 | { |
3805 | // this does need to be more complex later | 3794 | // this does need to be more complex later |
3806 | Vector3 vel = Velocity; | 3795 | Vector3 vel = Velocity; |
3807 | Vector3 dpos = m_pos - m_lastPosition; | 3796 | Vector3 dpos = m_pos - m_lastPosition; |
3808 | if( Math.Abs(vel.X - m_lastVelocity.X) > VELOCITY_TOLERANCE || | 3797 | if( State != m_lastState || |
3798 | Math.Abs(vel.X - m_lastVelocity.X) > VELOCITY_TOLERANCE || | ||
3809 | Math.Abs(vel.Y - m_lastVelocity.Y) > VELOCITY_TOLERANCE || | 3799 | Math.Abs(vel.Y - m_lastVelocity.Y) > VELOCITY_TOLERANCE || |
3810 | Math.Abs(vel.Z - m_lastVelocity.Z) > VELOCITY_TOLERANCE || | 3800 | Math.Abs(vel.Z - m_lastVelocity.Z) > VELOCITY_TOLERANCE || |
3811 | 3801 | ||
3812 | Math.Abs(m_bodyRot.X - m_lastRotation.X) > ROTATION_TOLERANCE || | 3802 | Math.Abs(m_bodyRot.X - m_lastRotation.X) > ROTATION_TOLERANCE || |
3813 | Math.Abs(m_bodyRot.Y - m_lastRotation.Y) > ROTATION_TOLERANCE || | 3803 | Math.Abs(m_bodyRot.Y - m_lastRotation.Y) > ROTATION_TOLERANCE || |
3814 | Math.Abs(m_bodyRot.Z - m_lastRotation.Z) > ROTATION_TOLERANCE || | 3804 | Math.Abs(m_bodyRot.Z - m_lastRotation.Z) > ROTATION_TOLERANCE || |
3805 | |||
3806 | (vel == Vector3.Zero && m_lastVelocity != Vector3.Zero) || | ||
3815 | 3807 | ||
3816 | Math.Abs(dpos.X) > POSITION_LARGETOLERANCE || | 3808 | Math.Abs(dpos.X) > POSITION_LARGETOLERANCE || |
3817 | Math.Abs(dpos.Y) > POSITION_LARGETOLERANCE || | 3809 | Math.Abs(dpos.Y) > POSITION_LARGETOLERANCE || |
@@ -3821,11 +3813,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
3821 | Math.Abs(dpos.Y) > POSITION_SMALLTOLERANCE || | 3813 | Math.Abs(dpos.Y) > POSITION_SMALLTOLERANCE || |
3822 | Math.Abs(dpos.Z) > POSITION_SMALLTOLERANCE) | 3814 | Math.Abs(dpos.Z) > POSITION_SMALLTOLERANCE) |
3823 | && vel.LengthSquared() < LOWVELOCITYSQ | 3815 | && vel.LengthSquared() < LOWVELOCITYSQ |
3824 | )) | 3816 | ) || |
3817 | |||
3818 | Math.Abs(CollisionPlane.X - m_lastCollisionPlane.X) > POSITION_SMALLTOLERANCE || | ||
3819 | Math.Abs(CollisionPlane.Y - m_lastCollisionPlane.Y) > POSITION_SMALLTOLERANCE || | ||
3820 | Math.Abs(CollisionPlane.W - m_lastCollisionPlane.W) > POSITION_SMALLTOLERANCE | ||
3821 | ) | ||
3825 | { | 3822 | { |
3826 | */ | ||
3827 | SendTerseUpdateToAllClients(); | 3823 | SendTerseUpdateToAllClients(); |
3828 | // } | 3824 | } |
3829 | } | 3825 | } |
3830 | CheckForSignificantMovement(); | 3826 | CheckForSignificantMovement(); |
3831 | } | 3827 | } |
@@ -3921,11 +3917,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
3921 | /// </summary> | 3917 | /// </summary> |
3922 | public void SendTerseUpdateToAllClients() | 3918 | public void SendTerseUpdateToAllClients() |
3923 | { | 3919 | { |
3924 | m_scene.ForEachScenePresence(SendTerseUpdateToAgent); | 3920 | m_lastState = State; |
3925 | // Update the "last" values | ||
3926 | m_lastPosition = m_pos; | 3921 | m_lastPosition = m_pos; |
3927 | m_lastRotation = m_bodyRot; | 3922 | m_lastRotation = m_bodyRot; |
3928 | m_lastVelocity = Velocity; | 3923 | m_lastVelocity = Velocity; |
3924 | m_lastCollisionPlane = CollisionPlane; | ||
3925 | |||
3926 | m_scene.ForEachScenePresence(SendTerseUpdateToAgent); | ||
3927 | // Update the "last" values | ||
3929 | TriggerScenePresenceUpdated(); | 3928 | TriggerScenePresenceUpdated(); |
3930 | } | 3929 | } |
3931 | 3930 | ||