aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs13
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs47
2 files changed, 55 insertions, 5 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 6e0fc43..4cbf3e1 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1912,6 +1912,7 @@ namespace OpenSim.Region.Framework.Scenes
1912 return Vector3.Zero; 1912 return Vector3.Zero;
1913 } 1913 }
1914 1914
1915 // This is used by both Double-Click Auto-Pilot and llMoveToTarget() in an attached object
1915 public void moveToTarget(Vector3 target, float tau) 1916 public void moveToTarget(Vector3 target, float tau)
1916 { 1917 {
1917 SceneObjectPart rootpart = m_rootPart; 1918 SceneObjectPart rootpart = m_rootPart;
@@ -1951,9 +1952,17 @@ namespace OpenSim.Region.Framework.Scenes
1951 SceneObjectPart rootpart = m_rootPart; 1952 SceneObjectPart rootpart = m_rootPart;
1952 if (rootpart != null) 1953 if (rootpart != null)
1953 { 1954 {
1954 if (rootpart.PhysActor != null) 1955 if (IsAttachment)
1955 { 1956 {
1956 rootpart.PhysActor.PIDActive = false; 1957 ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar);
1958 if (avatar != null) avatar.StopMoveToPosition();
1959 }
1960 else
1961 {
1962 if (rootpart.PhysActor != null)
1963 {
1964 rootpart.PhysActor.PIDActive = false;
1965 }
1957 } 1966 }
1958 } 1967 }
1959 } 1968 }
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 {