diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 50 |
1 files changed, 41 insertions, 9 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 289ba47..277081a 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -124,6 +124,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
124 | private Vector3? m_forceToApply; | 124 | private Vector3? m_forceToApply; |
125 | private uint m_requestedSitTargetID; | 125 | private uint m_requestedSitTargetID; |
126 | private UUID m_requestedSitTargetUUID; | 126 | private UUID m_requestedSitTargetUUID; |
127 | public bool SitGround = false; | ||
127 | 128 | ||
128 | private SendCourseLocationsMethod m_sendCourseLocationsMethod; | 129 | private SendCourseLocationsMethod m_sendCourseLocationsMethod; |
129 | 130 | ||
@@ -169,7 +170,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
169 | protected RegionInfo m_regionInfo; | 170 | protected RegionInfo m_regionInfo; |
170 | protected ulong crossingFromRegion; | 171 | protected ulong crossingFromRegion; |
171 | 172 | ||
172 | private readonly Vector3[] Dir_Vectors = new Vector3[6]; | 173 | private readonly Vector3[] Dir_Vectors = new Vector3[9]; |
173 | 174 | ||
174 | // Position of agent's camera in world (region cordinates) | 175 | // Position of agent's camera in world (region cordinates) |
175 | protected Vector3 m_CameraCenter; | 176 | protected Vector3 m_CameraCenter; |
@@ -233,6 +234,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
233 | DIR_CONTROL_FLAG_RIGHT = AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG, | 234 | DIR_CONTROL_FLAG_RIGHT = AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG, |
234 | DIR_CONTROL_FLAG_UP = AgentManager.ControlFlags.AGENT_CONTROL_UP_POS, | 235 | DIR_CONTROL_FLAG_UP = AgentManager.ControlFlags.AGENT_CONTROL_UP_POS, |
235 | DIR_CONTROL_FLAG_DOWN = AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG, | 236 | DIR_CONTROL_FLAG_DOWN = AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG, |
237 | DIR_CONTROL_FLAG_FORWARD_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS, | ||
238 | 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 | 239 | DIR_CONTROL_FLAG_DOWN_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG |
237 | } | 240 | } |
238 | 241 | ||
@@ -717,19 +720,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
717 | Dir_Vectors[3] = -Vector3.UnitY; //RIGHT | 720 | Dir_Vectors[3] = -Vector3.UnitY; //RIGHT |
718 | Dir_Vectors[4] = Vector3.UnitZ; //UP | 721 | Dir_Vectors[4] = Vector3.UnitZ; //UP |
719 | Dir_Vectors[5] = -Vector3.UnitZ; //DOWN | 722 | Dir_Vectors[5] = -Vector3.UnitZ; //DOWN |
720 | Dir_Vectors[5] = new Vector3(0f, 0f, -0.5f); //DOWN_Nudge | 723 | Dir_Vectors[8] = new Vector3(0f, 0f, -0.5f); //DOWN_Nudge |
724 | Dir_Vectors[6] = Vector3.UnitX*2; //FORWARD | ||
725 | Dir_Vectors[7] = -Vector3.UnitX; //BACK | ||
721 | } | 726 | } |
722 | 727 | ||
723 | private Vector3[] GetWalkDirectionVectors() | 728 | private Vector3[] GetWalkDirectionVectors() |
724 | { | 729 | { |
725 | Vector3[] vector = new Vector3[6]; | 730 | Vector3[] vector = new Vector3[9]; |
726 | vector[0] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD | 731 | 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 | 732 | vector[1] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK |
728 | vector[2] = Vector3.UnitY; //LEFT | 733 | vector[2] = Vector3.UnitY; //LEFT |
729 | vector[3] = -Vector3.UnitY; //RIGHT | 734 | vector[3] = -Vector3.UnitY; //RIGHT |
730 | vector[4] = new Vector3(m_CameraAtAxis.Z, 0f, m_CameraUpAxis.Z); //UP | 735 | 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 | 736 | 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 | 737 | vector[8] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN_Nudge |
738 | vector[6] = (new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z) * 2); //FORWARD Nudge | ||
739 | vector[7] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK Nudge | ||
733 | return vector; | 740 | return vector; |
734 | } | 741 | } |
735 | 742 | ||
@@ -1248,7 +1255,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1248 | // TODO: This doesn't prevent the user from walking yet. | 1255 | // TODO: This doesn't prevent the user from walking yet. |
1249 | // Setting parent ID would fix this, if we knew what value | 1256 | // Setting parent ID would fix this, if we knew what value |
1250 | // to use. Or we could add a m_isSitting variable. | 1257 | // to use. Or we could add a m_isSitting variable. |
1251 | Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); | 1258 | //Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); |
1259 | SitGround = true; | ||
1260 | |||
1252 | } | 1261 | } |
1253 | 1262 | ||
1254 | // In the future, these values might need to go global. | 1263 | // In the future, these values might need to go global. |
@@ -1306,6 +1315,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1306 | else | 1315 | else |
1307 | dirVectors = Dir_Vectors; | 1316 | dirVectors = Dir_Vectors; |
1308 | 1317 | ||
1318 | // The fact that m_movementflag is a byte needs to be fixed | ||
1319 | // it really should be a uint | ||
1320 | uint nudgehack = 250; | ||
1309 | foreach (Dir_ControlFlags DCF in DIR_CONTROL_FLAGS) | 1321 | foreach (Dir_ControlFlags DCF in DIR_CONTROL_FLAGS) |
1310 | { | 1322 | { |
1311 | if (((uint)flags & (uint)DCF) != 0) | 1323 | if (((uint)flags & (uint)DCF) != 0) |
@@ -1315,24 +1327,40 @@ namespace OpenSim.Region.Framework.Scenes | |||
1315 | try | 1327 | try |
1316 | { | 1328 | { |
1317 | agent_control_v3 += dirVectors[i]; | 1329 | agent_control_v3 += dirVectors[i]; |
1330 | //m_log.DebugFormat("[Motion]: {0}, {1}",i, dirVectors[i]); | ||
1318 | } | 1331 | } |
1319 | catch (IndexOutOfRangeException) | 1332 | catch (IndexOutOfRangeException) |
1320 | { | 1333 | { |
1321 | // Why did I get this? | 1334 | // Why did I get this? |
1322 | } | 1335 | } |
1323 | 1336 | ||
1324 | if ((m_movementflag & (uint)DCF) == 0) | 1337 | if ((m_movementflag & (byte)(uint)DCF) == 0) |
1325 | { | 1338 | { |
1339 | if (DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACKWARD_NUDGE) | ||
1340 | { | ||
1341 | m_movementflag |= (byte)nudgehack; | ||
1342 | } | ||
1326 | m_movementflag += (byte)(uint)DCF; | 1343 | m_movementflag += (byte)(uint)DCF; |
1327 | update_movementflag = true; | 1344 | update_movementflag = true; |
1328 | } | 1345 | } |
1329 | } | 1346 | } |
1330 | else | 1347 | else |
1331 | { | 1348 | { |
1332 | if ((m_movementflag & (uint)DCF) != 0) | 1349 | if ((m_movementflag & (byte)(uint)DCF) != 0 || |
1350 | ((DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACKWARD_NUDGE) | ||
1351 | && ((m_movementflag & (byte)nudgehack) == nudgehack)) | ||
1352 | ) // This or is for Nudge forward | ||
1333 | { | 1353 | { |
1334 | m_movementflag -= (byte)(uint)DCF; | 1354 | m_movementflag -= ((byte)(uint)DCF); |
1355 | |||
1335 | update_movementflag = true; | 1356 | update_movementflag = true; |
1357 | /* | ||
1358 | if ((DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACKWARD_NUDGE) | ||
1359 | && ((m_movementflag & (byte)nudgehack) == nudgehack)) | ||
1360 | { | ||
1361 | m_log.Debug("Removed Hack flag"); | ||
1362 | } | ||
1363 | */ | ||
1336 | } | 1364 | } |
1337 | else | 1365 | else |
1338 | { | 1366 | { |
@@ -1470,7 +1498,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1470 | } | 1498 | } |
1471 | } | 1499 | } |
1472 | 1500 | ||
1473 | if (update_movementflag) | 1501 | if (update_movementflag && ((flags & AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) == 0) && (m_parentID == 0) && !SitGround) |
1474 | Animator.UpdateMovementAnimations(); | 1502 | Animator.UpdateMovementAnimations(); |
1475 | 1503 | ||
1476 | m_scene.EventManager.TriggerOnClientMovement(this); | 1504 | m_scene.EventManager.TriggerOnClientMovement(this); |
@@ -1582,8 +1610,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1582 | /// </summary> | 1610 | /// </summary> |
1583 | public void StandUp() | 1611 | public void StandUp() |
1584 | { | 1612 | { |
1613 | if (SitGround) | ||
1614 | SitGround = false; | ||
1615 | |||
1585 | if (m_parentID != 0) | 1616 | if (m_parentID != 0) |
1586 | { | 1617 | { |
1618 | m_log.Debug("StandupCode Executed"); | ||
1587 | SceneObjectPart part = m_scene.GetSceneObjectPart(m_parentID); | 1619 | SceneObjectPart part = m_scene.GetSceneObjectPart(m_parentID); |
1588 | if (part != null) | 1620 | if (part != null) |
1589 | { | 1621 | { |