diff options
Merge branch 'careminster-presence-refactor' of ssh://3dhosting.de/var/git/careminster into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 13 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 47 |
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 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 | { |