diff options
author | Justin Clark-Casey (justincc) | 2011-08-03 02:59:49 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-08-03 02:59:49 +0100 |
commit | 68a5fe04318fed4b306e8405861203c19a313a2f (patch) | |
tree | 866cda5d1890ddf5758c146d3756be9480ee053e /OpenSim/Region/Framework/Scenes/ScenePresence.cs | |
parent | Implement move to/autopilot for z axis movement as well. (diff) | |
download | opensim-SC_OLD-68a5fe04318fed4b306e8405861203c19a313a2f.zip opensim-SC_OLD-68a5fe04318fed4b306e8405861203c19a313a2f.tar.gz opensim-SC_OLD-68a5fe04318fed4b306e8405861203c19a313a2f.tar.bz2 opensim-SC_OLD-68a5fe04318fed4b306e8405861203c19a313a2f.tar.xz |
Improve z axis move to/autopilot so the avatar does alternative crouch/huzzah when walking along the ground
Moving a flying avatar to a ground point doesn't yet land the avatar. This may or may not be the best thing
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 7b228c6..a610b6b 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -1522,7 +1522,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1522 | AddNewMovement(agent_control_v3, q); | 1522 | AddNewMovement(agent_control_v3, q); |
1523 | } | 1523 | } |
1524 | 1524 | ||
1525 | if (update_movementflag && ((flags & AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) == 0) && (m_parentID == 0) && !SitGround) | 1525 | if (update_movementflag |
1526 | && ((flags & AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) == 0) | ||
1527 | && (m_parentID == 0) | ||
1528 | && !SitGround | ||
1529 | && !m_moveToPositionInProgress) | ||
1526 | Animator.UpdateMovementAnimations(); | 1530 | Animator.UpdateMovementAnimations(); |
1527 | } | 1531 | } |
1528 | 1532 | ||
@@ -1559,9 +1563,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1559 | if (allowUpdate && (m_moveToPositionInProgress && !m_autopilotMoving)) | 1563 | if (allowUpdate && (m_moveToPositionInProgress && !m_autopilotMoving)) |
1560 | { | 1564 | { |
1561 | double distanceToTarget = Util.GetDistanceTo(AbsolutePosition, m_moveToPositionTarget); | 1565 | double distanceToTarget = Util.GetDistanceTo(AbsolutePosition, m_moveToPositionTarget); |
1562 | m_log.DebugFormat( | 1566 | // m_log.DebugFormat( |
1563 | "[SCENE PRESENCE]: Abs pos of {0} is {1}, target {2}, distance {3}", | 1567 | // "[SCENE PRESENCE]: Abs pos of {0} is {1}, target {2}, distance {3}", |
1564 | Name, AbsolutePosition, m_moveToPositionTarget, distanceToTarget); | 1568 | // Name, AbsolutePosition, m_moveToPositionTarget, distanceToTarget); |
1565 | 1569 | ||
1566 | // Check the error term of the current position in relation to the target position | 1570 | // Check the error term of the current position in relation to the target position |
1567 | if (distanceToTarget <= 1) | 1571 | if (distanceToTarget <= 1) |
@@ -1637,15 +1641,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
1637 | 1641 | ||
1638 | if (LocalVectorToTarget3D.Z > 0) //Up | 1642 | if (LocalVectorToTarget3D.Z > 0) //Up |
1639 | { | 1643 | { |
1640 | m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_UP; | 1644 | //m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_UP; |
1641 | //AgentControlFlags | 1645 | //AgentControlFlags |
1642 | AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_UP; | 1646 | //AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_UP; |
1643 | updated = true; | 1647 | updated = true; |
1644 | } | 1648 | } |
1645 | else if (LocalVectorToTarget3D.Z < 0) //Down | 1649 | else if (LocalVectorToTarget3D.Z < 0) //Down |
1646 | { | 1650 | { |
1647 | m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN; | 1651 | //m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN; |
1648 | AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN; | 1652 | //AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN; |
1649 | updated = true; | 1653 | updated = true; |
1650 | } | 1654 | } |
1651 | 1655 | ||
@@ -1694,16 +1698,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
1694 | /// <param name="pos"></param> | 1698 | /// <param name="pos"></param> |
1695 | public void DoMoveToPosition(uint not_used, Vector3 pos, IClientAPI remote_client) | 1699 | public void DoMoveToPosition(uint not_used, Vector3 pos, IClientAPI remote_client) |
1696 | { | 1700 | { |
1697 | m_log.DebugFormat( | 1701 | // m_log.DebugFormat( |
1698 | "[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}", | 1702 | // "[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}", |
1699 | Name, pos, m_scene.RegionInfo.RegionName); | 1703 | // Name, pos, m_scene.RegionInfo.RegionName); |
1704 | |||
1705 | if (pos.X < 0 || pos.X >= Constants.RegionSize | ||
1706 | || pos.Y < 0 || pos.Y >= Constants.RegionSize | ||
1707 | || pos.Z < 0) | ||
1708 | return; | ||
1700 | 1709 | ||
1701 | Vector3 heightAdjust = new Vector3(0, 0, Appearance.AvatarHeight / 2); | 1710 | Vector3 heightAdjust = new Vector3(0, 0, Appearance.AvatarHeight / 2); |
1702 | pos += heightAdjust; | 1711 | pos += heightAdjust; |
1703 | 1712 | ||
1704 | // Anti duck-walking measure | 1713 | // Anti duck-walking measure |
1705 | if (Math.Abs(pos.Z - AbsolutePosition.Z) < 0.2f) | 1714 | if (Math.Abs(pos.Z - AbsolutePosition.Z) < 0.2f) |
1715 | { | ||
1716 | // m_log.DebugFormat("[SCENE PRESENCE]: Adjusting MoveToPosition from {0} to {1}", pos, AbsolutePosition); | ||
1706 | pos.Z = AbsolutePosition.Z; | 1717 | pos.Z = AbsolutePosition.Z; |
1718 | } | ||
1707 | 1719 | ||
1708 | m_moveToPositionInProgress = true; | 1720 | m_moveToPositionInProgress = true; |
1709 | m_moveToPositionTarget = pos; | 1721 | m_moveToPositionTarget = pos; |