diff options
author | Justin Clark-Casey (justincc) | 2015-02-27 23:41:04 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2015-02-27 23:43:12 +0000 |
commit | 30b786351ea46cf6640dc45fa84bb4a4da1ab6d8 (patch) | |
tree | 788dc9959bd56b98d16fc204f4dc18d0e859ea80 /OpenSim/Region/Framework/Scenes/ScenePresence.cs | |
parent | Don't slide crouching avatar when camera is panned around them with left mous... (diff) | |
download | opensim-SC-30b786351ea46cf6640dc45fa84bb4a4da1ab6d8.zip opensim-SC-30b786351ea46cf6640dc45fa84bb4a4da1ab6d8.tar.gz opensim-SC-30b786351ea46cf6640dc45fa84bb4a4da1ab6d8.tar.bz2 opensim-SC-30b786351ea46cf6640dc45fa84bb4a4da1ab6d8.tar.xz |
Don't slow down avatar walk speed if camera is changed (e.g. by holding down lmb on an avatar and moving the mouse).
Does this by not applying unwanted direction components to the avatar self movement calculation (exception is flying in mouse look).
Matches behaviuor on linden lab grid
Addresses http://opensimulator.org/mantis/view.php?id=6835
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 40 |
1 files changed, 12 insertions, 28 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index a03593e..acd57a3 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -1010,23 +1010,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1010 | Dir_Vectors[10] = new Vector3(0f, 0f, -0.5f); //DOWN_Nudge | 1010 | Dir_Vectors[10] = new Vector3(0f, 0f, -0.5f); //DOWN_Nudge |
1011 | } | 1011 | } |
1012 | 1012 | ||
1013 | private Vector3[] GetWalkDirectionVectors() | ||
1014 | { | ||
1015 | Vector3[] vector = new Vector3[11]; | ||
1016 | vector[0] = new Vector3(CameraUpAxis.Z, 0f, -CameraAtAxis.Z); //FORWARD | ||
1017 | vector[1] = new Vector3(-CameraUpAxis.Z, 0f, CameraAtAxis.Z); //BACK | ||
1018 | vector[2] = Vector3.UnitY; //LEFT | ||
1019 | vector[3] = -Vector3.UnitY; //RIGHT | ||
1020 | vector[4] = new Vector3(CameraAtAxis.Z, 0f, CameraUpAxis.Z); //UP | ||
1021 | vector[5] = new Vector3(-CameraAtAxis.Z, 0f, -CameraUpAxis.Z); //DOWN | ||
1022 | vector[6] = new Vector3(CameraUpAxis.Z, 0f, -CameraAtAxis.Z); //FORWARD_NUDGE | ||
1023 | vector[7] = new Vector3(-CameraUpAxis.Z, 0f, CameraAtAxis.Z); //BACK_NUDGE | ||
1024 | vector[8] = Vector3.UnitY; //LEFT_NUDGE | ||
1025 | vector[9] = -Vector3.UnitY; //RIGHT_NUDGE | ||
1026 | vector[10] = new Vector3(-CameraAtAxis.Z, 0f, -CameraUpAxis.Z); //DOWN_NUDGE | ||
1027 | return vector; | ||
1028 | } | ||
1029 | |||
1030 | #endregion | 1013 | #endregion |
1031 | 1014 | ||
1032 | #region Status Methods | 1015 | #region Status Methods |
@@ -2110,15 +2093,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2110 | { | 2093 | { |
2111 | bool bAllowUpdateMoveToPosition = false; | 2094 | bool bAllowUpdateMoveToPosition = false; |
2112 | 2095 | ||
2113 | Vector3[] dirVectors; | ||
2114 | |||
2115 | // use camera up angle when in mouselook and not flying or when holding the left mouse button down and not flying | ||
2116 | // this prevents 'jumping' in inappropriate situations. | ||
2117 | if (!Flying && (m_mouseLook || m_leftButtonDown)) | ||
2118 | dirVectors = GetWalkDirectionVectors(); | ||
2119 | else | ||
2120 | dirVectors = Dir_Vectors; | ||
2121 | |||
2122 | // A DIR_CONTROL_FLAG occurs when the user is trying to move in a particular direction. | 2096 | // A DIR_CONTROL_FLAG occurs when the user is trying to move in a particular direction. |
2123 | foreach (Dir_ControlFlags DCF in DIR_CONTROL_FLAGS) | 2097 | foreach (Dir_ControlFlags DCF in DIR_CONTROL_FLAGS) |
2124 | { | 2098 | { |
@@ -2130,7 +2104,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2130 | { | 2104 | { |
2131 | // Don't slide against ground when crouching if camera is panned around avatar | 2105 | // Don't slide against ground when crouching if camera is panned around avatar |
2132 | if (Flying || DCF != Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN) | 2106 | if (Flying || DCF != Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN) |
2133 | agent_control_v3 += dirVectors[i]; | 2107 | agent_control_v3 += Dir_Vectors[i]; |
2134 | //m_log.DebugFormat("[Motion]: {0}, {1}",i, dirVectors[i]); | 2108 | //m_log.DebugFormat("[Motion]: {0}, {1}",i, dirVectors[i]); |
2135 | } | 2109 | } |
2136 | catch (IndexOutOfRangeException) | 2110 | catch (IndexOutOfRangeException) |
@@ -3164,7 +3138,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
3164 | // "[SCENE PRESENCE]: Adding new movement {0} with rotation {1}, thisAddSpeedModifier {2} for {3}", | 3138 | // "[SCENE PRESENCE]: Adding new movement {0} with rotation {1}, thisAddSpeedModifier {2} for {3}", |
3165 | // vec, Rotation, thisAddSpeedModifier, Name); | 3139 | // vec, Rotation, thisAddSpeedModifier, Name); |
3166 | 3140 | ||
3167 | Vector3 direc = vec * Rotation; | 3141 | Quaternion rot = Rotation; |
3142 | if (!(Flying && m_mouseLook)) | ||
3143 | { | ||
3144 | // The only situation in which we care about X and Y is in mouselook flying. The rest of the time | ||
3145 | // these parameters are not relevant for determining avatar movement direction and cause issues such | ||
3146 | // as wrong walk speed if the camera is rotated. | ||
3147 | rot.X = 0; | ||
3148 | rot.Y = 0; | ||
3149 | } | ||
3150 | |||
3151 | Vector3 direc = vec * rot; | ||
3168 | direc.Normalize(); | 3152 | direc.Normalize(); |
3169 | 3153 | ||
3170 | if (Flying != FlyingOld) // add for fly velocity control | 3154 | if (Flying != FlyingOld) // add for fly velocity control |