diff options
author | Teravus Ovares (Dan Olivares) | 2009-12-30 15:01:14 -0500 |
---|---|---|
committer | Teravus Ovares (Dan Olivares) | 2009-12-30 15:01:14 -0500 |
commit | 16a64c400b866d20ed80287f624fff89cc187145 (patch) | |
tree | d292a4f366faecd2c8db499bf7b59f487fa01b26 /OpenSim | |
parent | Merge branch 'master' of ssh://MyConnection/var/git/opensim (diff) | |
download | opensim-SC-16a64c400b866d20ed80287f624fff89cc187145.zip opensim-SC-16a64c400b866d20ed80287f624fff89cc187145.tar.gz opensim-SC-16a64c400b866d20ed80287f624fff89cc187145.tar.bz2 opensim-SC-16a64c400b866d20ed80287f624fff89cc187145.tar.xz |
* Makes forward and backward key reactions faster by responding to the NUDGE type movements.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs | 3 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 41 |
2 files changed, 35 insertions, 9 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index c314596..8b1d705 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs | |||
@@ -156,7 +156,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
156 | Vector3 left = Vector3.Transform(Vector3.UnitY, rotMatrix); | 156 | Vector3 left = Vector3.Transform(Vector3.UnitY, rotMatrix); |
157 | 157 | ||
158 | // Check control flags | 158 | // Check control flags |
159 | bool heldForward = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_AT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_AT_POS; | 159 | bool heldForward = |
160 | (((controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_AT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_AT_POS) || ((controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS)); | ||
160 | bool heldBack = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG; | 161 | bool heldBack = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG; |
161 | bool heldLeft = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS; | 162 | bool heldLeft = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS; |
162 | bool heldRight = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG; | 163 | bool heldRight = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG; |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 289ba47..4c2de27 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -169,7 +169,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
169 | protected RegionInfo m_regionInfo; | 169 | protected RegionInfo m_regionInfo; |
170 | protected ulong crossingFromRegion; | 170 | protected ulong crossingFromRegion; |
171 | 171 | ||
172 | private readonly Vector3[] Dir_Vectors = new Vector3[6]; | 172 | private readonly Vector3[] Dir_Vectors = new Vector3[9]; |
173 | 173 | ||
174 | // Position of agent's camera in world (region cordinates) | 174 | // Position of agent's camera in world (region cordinates) |
175 | protected Vector3 m_CameraCenter; | 175 | protected Vector3 m_CameraCenter; |
@@ -233,6 +233,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
233 | DIR_CONTROL_FLAG_RIGHT = AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG, | 233 | DIR_CONTROL_FLAG_RIGHT = AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG, |
234 | DIR_CONTROL_FLAG_UP = AgentManager.ControlFlags.AGENT_CONTROL_UP_POS, | 234 | DIR_CONTROL_FLAG_UP = AgentManager.ControlFlags.AGENT_CONTROL_UP_POS, |
235 | DIR_CONTROL_FLAG_DOWN = AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG, | 235 | DIR_CONTROL_FLAG_DOWN = AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG, |
236 | DIR_CONTROL_FLAG_FORWARD_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS, | ||
237 | DIR_CONTROL_FLAG_BACKWARD_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG, | ||
236 | DIR_CONTROL_FLAG_DOWN_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG | 238 | DIR_CONTROL_FLAG_DOWN_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG |
237 | } | 239 | } |
238 | 240 | ||
@@ -717,19 +719,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
717 | Dir_Vectors[3] = -Vector3.UnitY; //RIGHT | 719 | Dir_Vectors[3] = -Vector3.UnitY; //RIGHT |
718 | Dir_Vectors[4] = Vector3.UnitZ; //UP | 720 | Dir_Vectors[4] = Vector3.UnitZ; //UP |
719 | Dir_Vectors[5] = -Vector3.UnitZ; //DOWN | 721 | Dir_Vectors[5] = -Vector3.UnitZ; //DOWN |
720 | Dir_Vectors[5] = new Vector3(0f, 0f, -0.5f); //DOWN_Nudge | 722 | Dir_Vectors[8] = new Vector3(0f, 0f, -0.5f); //DOWN_Nudge |
723 | Dir_Vectors[6] = Vector3.UnitX*2; //FORWARD | ||
724 | Dir_Vectors[7] = -Vector3.UnitX; //BACK | ||
721 | } | 725 | } |
722 | 726 | ||
723 | private Vector3[] GetWalkDirectionVectors() | 727 | private Vector3[] GetWalkDirectionVectors() |
724 | { | 728 | { |
725 | Vector3[] vector = new Vector3[6]; | 729 | Vector3[] vector = new Vector3[9]; |
726 | vector[0] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD | 730 | vector[0] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD |
727 | vector[1] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK | 731 | vector[1] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK |
728 | vector[2] = Vector3.UnitY; //LEFT | 732 | vector[2] = Vector3.UnitY; //LEFT |
729 | vector[3] = -Vector3.UnitY; //RIGHT | 733 | vector[3] = -Vector3.UnitY; //RIGHT |
730 | vector[4] = new Vector3(m_CameraAtAxis.Z, 0f, m_CameraUpAxis.Z); //UP | 734 | vector[4] = new Vector3(m_CameraAtAxis.Z, 0f, m_CameraUpAxis.Z); //UP |
731 | vector[5] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN | 735 | vector[5] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN |
732 | vector[5] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN_Nudge | 736 | vector[8] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN_Nudge |
737 | vector[6] = (new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z) * 2); //FORWARD Nudge | ||
738 | vector[7] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK Nudge | ||
733 | return vector; | 739 | return vector; |
734 | } | 740 | } |
735 | 741 | ||
@@ -1306,6 +1312,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1306 | else | 1312 | else |
1307 | dirVectors = Dir_Vectors; | 1313 | dirVectors = Dir_Vectors; |
1308 | 1314 | ||
1315 | // The fact that m_movementflag is a byte needs to be fixed | ||
1316 | // it really should be a uint | ||
1317 | uint nudgehack = 250; | ||
1309 | foreach (Dir_ControlFlags DCF in DIR_CONTROL_FLAGS) | 1318 | foreach (Dir_ControlFlags DCF in DIR_CONTROL_FLAGS) |
1310 | { | 1319 | { |
1311 | if (((uint)flags & (uint)DCF) != 0) | 1320 | if (((uint)flags & (uint)DCF) != 0) |
@@ -1315,24 +1324,40 @@ namespace OpenSim.Region.Framework.Scenes | |||
1315 | try | 1324 | try |
1316 | { | 1325 | { |
1317 | agent_control_v3 += dirVectors[i]; | 1326 | agent_control_v3 += dirVectors[i]; |
1327 | //m_log.DebugFormat("[Motion]: {0}, {1}",i, dirVectors[i]); | ||
1318 | } | 1328 | } |
1319 | catch (IndexOutOfRangeException) | 1329 | catch (IndexOutOfRangeException) |
1320 | { | 1330 | { |
1321 | // Why did I get this? | 1331 | // Why did I get this? |
1322 | } | 1332 | } |
1323 | 1333 | ||
1324 | if ((m_movementflag & (uint)DCF) == 0) | 1334 | if ((m_movementflag & (byte)(uint)DCF) == 0) |
1325 | { | 1335 | { |
1336 | if (DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACKWARD_NUDGE) | ||
1337 | { | ||
1338 | m_movementflag |= (byte)nudgehack; | ||
1339 | } | ||
1326 | m_movementflag += (byte)(uint)DCF; | 1340 | m_movementflag += (byte)(uint)DCF; |
1327 | update_movementflag = true; | 1341 | update_movementflag = true; |
1328 | } | 1342 | } |
1329 | } | 1343 | } |
1330 | else | 1344 | else |
1331 | { | 1345 | { |
1332 | if ((m_movementflag & (uint)DCF) != 0) | 1346 | if ((m_movementflag & (byte)(uint)DCF) != 0 || |
1347 | ((DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACKWARD_NUDGE) | ||
1348 | && ((m_movementflag & (byte)nudgehack) == nudgehack)) | ||
1349 | ) // This or is for Nudge forward | ||
1333 | { | 1350 | { |
1334 | m_movementflag -= (byte)(uint)DCF; | 1351 | m_movementflag -= ((byte)(uint)DCF); |
1352 | |||
1335 | update_movementflag = true; | 1353 | update_movementflag = true; |
1354 | /* | ||
1355 | if ((DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACKWARD_NUDGE) | ||
1356 | && ((m_movementflag & (byte)nudgehack) == nudgehack)) | ||
1357 | { | ||
1358 | m_log.Debug("Removed Hack flag"); | ||
1359 | } | ||
1360 | */ | ||
1336 | } | 1361 | } |
1337 | else | 1362 | else |
1338 | { | 1363 | { |
@@ -1470,7 +1495,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1470 | } | 1495 | } |
1471 | } | 1496 | } |
1472 | 1497 | ||
1473 | if (update_movementflag) | 1498 | if (update_movementflag && ((flags & AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) == 0) && (m_parentID == 0)) |
1474 | Animator.UpdateMovementAnimations(); | 1499 | Animator.UpdateMovementAnimations(); |
1475 | 1500 | ||
1476 | m_scene.EventManager.TriggerOnClientMovement(this); | 1501 | m_scene.EventManager.TriggerOnClientMovement(this); |