aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
authorKitto Flora2011-02-04 17:31:52 +0000
committerKitto Flora2011-02-04 17:31:52 +0000
commitb6dda231f2d6be6ac7684048a11f1f0516ed3067 (patch)
tree0151214f07983008246593dbea65b8e6b43d0222 /OpenSim/Region/Framework/Scenes/ScenePresence.cs
parentIf llHTTPRequest results in an error, still attempt to get the response text.... (diff)
downloadopensim-SC-b6dda231f2d6be6ac7684048a11f1f0516ed3067.zip
opensim-SC-b6dda231f2d6be6ac7684048a11f1f0516ed3067.tar.gz
opensim-SC-b6dda231f2d6be6ac7684048a11f1f0516ed3067.tar.bz2
opensim-SC-b6dda231f2d6be6ac7684048a11f1f0516ed3067.tar.xz
Corrections for Avatar Auto-pilot target; add llStopMoveToTarget() for Avatar-attached.
Diffstat (limited to '')
-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 b54d1b8..b87275c 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1605,8 +1605,41 @@ namespace OpenSim.Region.Framework.Scenes
1605 1605
1606 if (bAllowUpdateMoveToPosition && (m_moveToPositionInProgress && !m_autopilotMoving)) 1606 if (bAllowUpdateMoveToPosition && (m_moveToPositionInProgress && !m_autopilotMoving))
1607 { 1607 {
1608/*
1609 bool twoD = false;
1610 bool there = false;
1611 if (Animator != null)
1612 {
1613 switch (Animator.CurrentMovementAnimation)
1614 {
1615 case "STAND":
1616 case "WALK":
1617 case "RUN":
1618 case "CROUCH":
1619 case "CROUCHWALK":
1620 {
1621 twoD = true;
1622 }
1623 break;
1624 }
1625 }
1626
1627 if (twoD)
1628 {
1629*/
1630 Vector3 abspos = new Vector3(AbsolutePosition.X, AbsolutePosition.Y, 0.0f);
1631 Vector3 tgt = new Vector3(m_moveToPositionTarget.X, m_moveToPositionTarget.Y, 0.0f);
1632/* if (Util.GetDistanceTo(abspos, tgt) <= 0.5f) there = true;
1633 }
1634 else
1635 {
1636 if (Util.GetDistanceTo(AbsolutePosition, m_moveToPositionTarget) <= 0.5f) there = true;
1637 }
1638*/
1608 //Check the error term of the current position in relation to the target position 1639 //Check the error term of the current position in relation to the target position
1609 if (Util.GetDistanceTo(AbsolutePosition, m_moveToPositionTarget) <= 0.5f) 1640// if (Util.GetDistanceTo(AbsolutePosition, m_moveToPositionTarget) <= 0.5f)
1641// if (there)
1642 if (Util.GetDistanceTo(abspos, tgt) <= 0.5f)
1610 { 1643 {
1611 // we are close enough to the target 1644 // we are close enough to the target
1612 m_moveToPositionTarget = Vector3.Zero; 1645 m_moveToPositionTarget = Vector3.Zero;
@@ -1623,7 +1656,8 @@ namespace OpenSim.Region.Framework.Scenes
1623 // unknown forces are acting on the avatar and we need to adaptively respond 1656 // unknown forces are acting on the avatar and we need to adaptively respond
1624 // to such forces, but the following simple approach seems to works fine. 1657 // to such forces, but the following simple approach seems to works fine.
1625 Vector3 LocalVectorToTarget3D = 1658 Vector3 LocalVectorToTarget3D =
1626 (m_moveToPositionTarget - AbsolutePosition) // vector from cur. pos to target in global coords 1659// (m_moveToPositionTarget - AbsolutePosition) // vector from cur. pos to target in global coords
1660 (tgt - abspos)
1627 * Matrix4.CreateFromQuaternion(Quaternion.Inverse(bodyRotation)); // change to avatar coords 1661 * Matrix4.CreateFromQuaternion(Quaternion.Inverse(bodyRotation)); // change to avatar coords
1628 // Ignore z component of vector 1662 // Ignore z component of vector
1629 Vector3 LocalVectorToTarget2D = new Vector3((float)(LocalVectorToTarget3D.X), (float)(LocalVectorToTarget3D.Y), 0f); 1663 Vector3 LocalVectorToTarget2D = new Vector3((float)(LocalVectorToTarget3D.X), (float)(LocalVectorToTarget3D.Y), 0f);
@@ -1760,8 +1794,15 @@ namespace OpenSim.Region.Framework.Scenes
1760// } 1794// }
1761 } 1795 }
1762 1796
1797 public void StopMoveToPosition()
1798 {
1799 m_moveToPositionTarget = Vector3.Zero;
1800 m_moveToPositionInProgress = false;
1801 }
1802
1763 public void DoMoveToPosition(Object sender, string method, List<String> args) 1803 public void DoMoveToPosition(Object sender, string method, List<String> args)
1764 { 1804 {
1805//Console.WriteLine("SP:DoMoveToPosition");
1765 try 1806 try
1766 { 1807 {
1767 float locx = 0f; 1808 float locx = 0f;
@@ -1782,7 +1823,7 @@ namespace OpenSim.Region.Framework.Scenes
1782 return; 1823 return;
1783 } 1824 }
1784 m_moveToPositionInProgress = true; 1825 m_moveToPositionInProgress = true;
1785 m_moveToPositionTarget = new Vector3(locx, locy, locz + (m_appearance.AvatarHeight / 2.0f)); 1826 m_moveToPositionTarget = new Vector3(locx, locy, locz);
1786 } 1827 }
1787 catch (Exception ex) 1828 catch (Exception ex)
1788 { 1829 {