aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs47
1 files changed, 44 insertions, 3 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 6267797..3a5b05d 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1611,8 +1611,41 @@ namespace OpenSim.Region.Framework.Scenes
1611 1611
1612 if (bAllowUpdateMoveToPosition && (m_moveToPositionInProgress && !m_autopilotMoving)) 1612 if (bAllowUpdateMoveToPosition && (m_moveToPositionInProgress && !m_autopilotMoving))
1613 { 1613 {
1614/*
1615 bool twoD = false;
1616 bool there = false;
1617 if (Animator != null)
1618 {
1619 switch (Animator.CurrentMovementAnimation)
1620 {
1621 case "STAND":
1622 case "WALK":
1623 case "RUN":
1624 case "CROUCH":
1625 case "CROUCHWALK":
1626 {
1627 twoD = true;
1628 }
1629 break;
1630 }
1631 }
1632
1633 if (twoD)
1634 {
1635*/
1636 Vector3 abspos = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, 0.0f);
1637 Vector3 tgt = new Vector3(m_moveToPositionTarget.X, m_moveToPositionTarget.Y, 0.0f);
1638/* if (Util.GetDistanceTo(abspos, tgt) <= 0.5f) there = true;
1639 }
1640 else
1641 {
1642 if (Util.GetDistanceTo(AbsolutePosition, m_moveToPositionTarget) <= 0.5f) there = true;
1643 }
1644*/
1614 //Check the error term of the current position in relation to the target position 1645 //Check the error term of the current position in relation to the target position
1615 if (Util.GetDistanceTo(AbsolutePosition, m_moveToPositionTarget) <= 0.5f) 1646// if (Util.GetDistanceTo(AbsolutePosition, m_moveToPositionTarget) <= 0.5f)
1647// if (there)
1648 if (Util.GetDistanceTo(abspos, tgt) <= 0.5f)
1616 { 1649 {
1617 // we are close enough to the target 1650 // we are close enough to the target
1618 m_moveToPositionTarget = Vector3.Zero; 1651 m_moveToPositionTarget = Vector3.Zero;
@@ -1629,7 +1662,8 @@ namespace OpenSim.Region.Framework.Scenes
1629 // unknown forces are acting on the avatar and we need to adaptively respond 1662 // unknown forces are acting on the avatar and we need to adaptively respond
1630 // to such forces, but the following simple approach seems to works fine. 1663 // to such forces, but the following simple approach seems to works fine.
1631 Vector3 LocalVectorToTarget3D = 1664 Vector3 LocalVectorToTarget3D =
1632 (m_moveToPositionTarget - AbsolutePosition) // vector from cur. pos to target in global coords 1665// (m_moveToPositionTarget - AbsolutePosition) // vector from cur. pos to target in global coords
1666 (tgt - abspos)
1633 * Matrix4.CreateFromQuaternion(Quaternion.Inverse(bodyRotation)); // change to avatar coords 1667 * Matrix4.CreateFromQuaternion(Quaternion.Inverse(bodyRotation)); // change to avatar coords
1634 // Ignore z component of vector 1668 // Ignore z component of vector
1635 Vector3 LocalVectorToTarget2D = new Vector3((float)(LocalVectorToTarget3D.X), (float)(LocalVectorToTarget3D.Y), 0f); 1669 Vector3 LocalVectorToTarget2D = new Vector3((float)(LocalVectorToTarget3D.X), (float)(LocalVectorToTarget3D.Y), 0f);
@@ -1766,8 +1800,15 @@ namespace OpenSim.Region.Framework.Scenes
1766// } 1800// }
1767 } 1801 }
1768 1802
1803 public void StopMoveToPosition()
1804 {
1805 m_moveToPositionTarget = Vector3.Zero;
1806 m_moveToPositionInProgress = false;
1807 }
1808
1769 public void DoMoveToPosition(Object sender, string method, List<String> args) 1809 public void DoMoveToPosition(Object sender, string method, List<String> args)
1770 { 1810 {
1811//Console.WriteLine("SP:DoMoveToPosition");
1771 try 1812 try
1772 { 1813 {
1773 float locx = 0f; 1814 float locx = 0f;
@@ -1788,7 +1829,7 @@ namespace OpenSim.Region.Framework.Scenes
1788 return; 1829 return;
1789 } 1830 }
1790 m_moveToPositionInProgress = true; 1831 m_moveToPositionInProgress = true;
1791 m_moveToPositionTarget = new Vector3(locx, locy, locz + (m_appearance.AvatarHeight / 2.0f)); 1832 m_moveToPositionTarget = new Vector3(locx, locy, locz);
1792 } 1833 }
1793 catch (Exception ex) 1834 catch (Exception ex)
1794 { 1835 {