aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
authorUbitUmarov2017-06-03 07:01:07 +0100
committerUbitUmarov2017-06-03 07:01:07 +0100
commitf26ad07ce122c43465b9503e36ce3191316a3777 (patch)
tree2006eda504a0eb9cd5089215ae48c138dc210cb1 /OpenSim/Region/Framework/Scenes
parentcross mouse buttons state (diff)
downloadopensim-SC_OLD-f26ad07ce122c43465b9503e36ce3191316a3777.zip
opensim-SC_OLD-f26ad07ce122c43465b9503e36ce3191316a3777.tar.gz
opensim-SC_OLD-f26ad07ce122c43465b9503e36ce3191316a3777.tar.bz2
opensim-SC_OLD-f26ad07ce122c43465b9503e36ce3191316a3777.tar.xz
add a delayed stop so fast tap on move keys does not stop the avatar in some cases
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs34
1 files changed, 28 insertions, 6 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index cec21d8..ed9cf53 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -364,6 +364,7 @@ namespace OpenSim.Region.Framework.Scenes
364 //PauPaw:Proper PID Controler for autopilot************ 364 //PauPaw:Proper PID Controler for autopilot************
365 public bool MovingToTarget { get; private set; } 365 public bool MovingToTarget { get; private set; }
366 public Vector3 MoveToPositionTarget { get; private set; } 366 public Vector3 MoveToPositionTarget { get; private set; }
367 private double m_delayedStop = -1.0;
367 368
368 /// <summary> 369 /// <summary>
369 /// Controls whether an avatar automatically moving to a target will land when it gets there (if flying). 370 /// Controls whether an avatar automatically moving to a target will land when it gets there (if flying).
@@ -2732,7 +2733,6 @@ namespace OpenSim.Region.Framework.Scenes
2732 agent_control_v3.Z = 0; 2733 agent_control_v3.Z = 0;
2733// else if(AgentControlStopActive %% Velocity.Z <0.01f) 2734// else if(AgentControlStopActive %% Velocity.Z <0.01f)
2734 2735
2735
2736// m_log.DebugFormat("[SCENE PRESENCE]: MovementFlag {0} for {1}", MovementFlag, Name); 2736// m_log.DebugFormat("[SCENE PRESENCE]: MovementFlag {0} for {1}", MovementFlag, Name);
2737 2737
2738 // If the agent update does move the avatar, then calculate the force ready for the velocity update, 2738 // If the agent update does move the avatar, then calculate the force ready for the velocity update,
@@ -2741,6 +2741,7 @@ namespace OpenSim.Region.Framework.Scenes
2741 // held down AGENT_CONTROL_STOP whilst normal walking/running). However, we do not want to update 2741 // held down AGENT_CONTROL_STOP whilst normal walking/running). However, we do not want to update
2742 // if the user rotated whilst holding down AGENT_CONTROL_STOP when already still (which locks the 2742 // if the user rotated whilst holding down AGENT_CONTROL_STOP when already still (which locks the
2743 // avatar location in place). 2743 // avatar location in place).
2744
2744 if (update_movementflag 2745 if (update_movementflag
2745 || (update_rotation && DCFlagKeyPressed && (!AgentControlStopActive || MovementFlag != 0))) 2746 || (update_rotation && DCFlagKeyPressed && (!AgentControlStopActive || MovementFlag != 0)))
2746 { 2747 {
@@ -2757,12 +2758,22 @@ namespace OpenSim.Region.Framework.Scenes
2757 } 2758 }
2758 else 2759 else
2759 { 2760 {
2760 AddNewMovement(agent_control_v3); 2761 if(MovingToTarget ||
2762 (Animator.currentControlState != ScenePresenceAnimator.motionControlStates.flying &&
2763 Animator.currentControlState != ScenePresenceAnimator.motionControlStates.onsurface)
2764 )
2765 AddNewMovement(agent_control_v3);
2766 else
2767 {
2768 if (MovementFlag != 0)
2769 AddNewMovement(agent_control_v3);
2770 else
2771 m_delayedStop = Util.GetTimeStampMS() + 200.0;
2772 }
2761 } 2773 }
2762
2763 } 2774 }
2764 2775
2765 if (update_movementflag && ParentID == 0) 2776 if (update_movementflag && ParentID == 0 && m_delayedStop < 0)
2766 { 2777 {
2767// m_log.DebugFormat("[SCENE PRESENCE]: Updating movement animations for {0}", Name); 2778// m_log.DebugFormat("[SCENE PRESENCE]: Updating movement animations for {0}", Name);
2768 Animator.UpdateMovementAnimations(); 2779 Animator.UpdateMovementAnimations();
@@ -3016,6 +3027,8 @@ namespace OpenSim.Region.Framework.Scenes
3016 /// </param> 3027 /// </param>
3017 public void MoveToTarget(Vector3 pos, bool noFly, bool landAtTarget) 3028 public void MoveToTarget(Vector3 pos, bool noFly, bool landAtTarget)
3018 { 3029 {
3030 m_delayedStop = -1;
3031
3019 if (SitGround) 3032 if (SitGround)
3020 StandUp(); 3033 StandUp();
3021 3034
@@ -3671,7 +3684,7 @@ namespace OpenSim.Region.Framework.Scenes
3671 // m_log.DebugFormat( 3684 // m_log.DebugFormat(
3672 // "[SCENE PRESENCE]: Adding new movement {0} with rotation {1}, thisAddSpeedModifier {2} for {3}", 3685 // "[SCENE PRESENCE]: Adding new movement {0} with rotation {1}, thisAddSpeedModifier {2} for {3}",
3673 // vec, Rotation, thisAddSpeedModifier, Name); 3686 // vec, Rotation, thisAddSpeedModifier, Name);
3674 3687 m_delayedStop = -1;
3675 // rotate from avatar coord space to world 3688 // rotate from avatar coord space to world
3676 Quaternion rot = Rotation; 3689 Quaternion rot = Rotation;
3677 if (!Flying && PresenceType != PresenceType.Npc) 3690 if (!Flying && PresenceType != PresenceType.Npc)
@@ -3689,7 +3702,7 @@ namespace OpenSim.Region.Framework.Scenes
3689 direc.Z = 0f; // Prevent camera WASD up. 3702 direc.Z = 0f; // Prevent camera WASD up.
3690 3703
3691 // odd rescalings 3704 // odd rescalings
3692 direc *= 0.03f * 128f * SpeedModifier * thisAddSpeedModifier; 3705 direc *= 0.032f * 128f * SpeedModifier * thisAddSpeedModifier;
3693 3706
3694 // m_log.DebugFormat("[SCENE PRESENCE]: Force to apply before modification was {0} for {1}", direc, Name); 3707 // m_log.DebugFormat("[SCENE PRESENCE]: Force to apply before modification was {0} for {1}", direc, Name);
3695 3708
@@ -3754,10 +3767,19 @@ namespace OpenSim.Region.Framework.Scenes
3754 3767
3755 if(MovingToTarget) 3768 if(MovingToTarget)
3756 { 3769 {
3770 m_delayedStop = -1;
3757 Vector3 control = Vector3.Zero; 3771 Vector3 control = Vector3.Zero;
3758 if(HandleMoveToTargetUpdate(1f, ref control)) 3772 if(HandleMoveToTargetUpdate(1f, ref control))
3759 AddNewMovement(control); 3773 AddNewMovement(control);
3760 } 3774 }
3775 else if(m_delayedStop > 0)
3776 {
3777 if(IsSatOnObject)
3778 m_delayedStop = -1;
3779 else
3780 if(Util.GetTimeStampMS() > m_delayedStop)
3781 AddNewMovement(Vector3.Zero);
3782 }
3761 3783
3762 if (Appearance.AvatarSize != m_lastSize) 3784 if (Appearance.AvatarSize != m_lastSize)
3763 SendAvatarDataToAllAgents(); 3785 SendAvatarDataToAllAgents();