aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs12
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs11
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs21
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs11
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs160
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs433
-rw-r--r--OpenSim/Region/Framework/Scenes/UndoState.cs2
8 files changed, 351 insertions, 304 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index 4865481..4ab818f 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -27,6 +27,8 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection;
31using log4net;
30using OpenMetaverse; 32using OpenMetaverse;
31using OpenSim.Framework; 33using OpenSim.Framework;
32using OpenSim.Region.Framework.Interfaces; 34using OpenSim.Region.Framework.Interfaces;
@@ -40,6 +42,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
40 /// </summary> 42 /// </summary>
41 public class ScenePresenceAnimator 43 public class ScenePresenceAnimator
42 { 44 {
45// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46
43 public AnimationSet Animations 47 public AnimationSet Animations
44 { 48 {
45 get { return m_animations; } 49 get { return m_animations; }
@@ -262,7 +266,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
262 266
263 m_animTickFall = 0; 267 m_animTickFall = 0;
264 268
265 if (move.Z > 0f) 269 if (move.Z > 0.2f)
266 { 270 {
267 // Jumping 271 // Jumping
268 if (!jumping) 272 if (!jumping)
@@ -295,7 +299,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
295 if (move.X != 0f || move.Y != 0f) 299 if (move.X != 0f || move.Y != 0f)
296 { 300 {
297 // Walking / crouchwalking / running 301 // Walking / crouchwalking / running
298 if (move.Z < 0f) 302 if (move.Z < 0)
299 return "CROUCHWALK"; 303 return "CROUCHWALK";
300 else if (m_scenePresence.SetAlwaysRun) 304 else if (m_scenePresence.SetAlwaysRun)
301 return "RUN"; 305 return "RUN";
@@ -305,7 +309,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
305 else 309 else
306 { 310 {
307 // Not walking 311 // Not walking
308 if (move.Z < 0f) 312 if (move.Z < 0)
309 return "CROUCH"; 313 return "CROUCH";
310 else 314 else
311 return "STAND"; 315 return "STAND";
@@ -323,6 +327,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
323 public void UpdateMovementAnimations() 327 public void UpdateMovementAnimations()
324 { 328 {
325 m_movementAnimation = GetMovementAnimation(); 329 m_movementAnimation = GetMovementAnimation();
330// m_log.DebugFormat(
331// "[SCENE PRESENCE ANIMATOR]: Got animation {0} for {1}", m_movementAnimation, m_scenePresence.Name);
326 TrySetMovementAnimation(m_movementAnimation); 332 TrySetMovementAnimation(m_movementAnimation);
327 } 333 }
328 334
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index b67937d..96da2c3 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -165,8 +165,7 @@ namespace OpenSim.Region.Framework.Scenes
165 public delegate void AvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID); 165 public delegate void AvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID);
166 public event AvatarEnteringNewParcel OnAvatarEnteringNewParcel; 166 public event AvatarEnteringNewParcel OnAvatarEnteringNewParcel;
167 167
168 public delegate void SignificantClientMovement(IClientAPI remote_client); 168 public event Action<ScenePresence> OnSignificantClientMovement;
169 public event SignificantClientMovement OnSignificantClientMovement;
170 169
171 public delegate void IncomingInstantMessage(GridInstantMessage message); 170 public delegate void IncomingInstantMessage(GridInstantMessage message);
172 public event IncomingInstantMessage OnIncomingInstantMessage; 171 public event IncomingInstantMessage OnIncomingInstantMessage;
@@ -1592,16 +1591,16 @@ namespace OpenSim.Region.Framework.Scenes
1592 } 1591 }
1593 } 1592 }
1594 1593
1595 public void TriggerSignificantClientMovement(IClientAPI client) 1594 public void TriggerSignificantClientMovement(ScenePresence presence)
1596 { 1595 {
1597 SignificantClientMovement handlerSignificantClientMovement = OnSignificantClientMovement; 1596 Action<ScenePresence> handlerSignificantClientMovement = OnSignificantClientMovement;
1598 if (handlerSignificantClientMovement != null) 1597 if (handlerSignificantClientMovement != null)
1599 { 1598 {
1600 foreach (SignificantClientMovement d in handlerSignificantClientMovement.GetInvocationList()) 1599 foreach (Action<ScenePresence> d in handlerSignificantClientMovement.GetInvocationList())
1601 { 1600 {
1602 try 1601 try
1603 { 1602 {
1604 d(client); 1603 d(presence);
1605 } 1604 }
1606 catch (Exception e) 1605 catch (Exception e)
1607 { 1606 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 30421d4..afc1a4f 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -724,7 +724,10 @@ namespace OpenSim.Region.Framework.Scenes
724 newName = item.Name; 724 newName = item.Name;
725 } 725 }
726 726
727 if (remoteClient.AgentId == oldAgentID || (LibraryService != null && LibraryService.LibraryRootFolder != null && oldAgentID == LibraryService.LibraryRootFolder.Owner)) 727 if (remoteClient.AgentId == oldAgentID
728 || (LibraryService != null
729 && LibraryService.LibraryRootFolder != null
730 && oldAgentID == LibraryService.LibraryRootFolder.Owner))
728 { 731 {
729 CreateNewInventoryItem( 732 CreateNewInventoryItem(
730 remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Flags, callbackID, asset, (sbyte)item.InvType, 733 remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Flags, callbackID, asset, (sbyte)item.InvType,
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 32a2887..b3b6cbc 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3079,7 +3079,7 @@ namespace OpenSim.Region.Framework.Scenes
3079 if (aCircuit == null) 3079 if (aCircuit == null)
3080 { 3080 {
3081 m_log.DebugFormat("[APPEARANCE] Client did not supply a circuit. Non-Linden? Creating default appearance."); 3081 m_log.DebugFormat("[APPEARANCE] Client did not supply a circuit. Non-Linden? Creating default appearance.");
3082 appearance = new AvatarAppearance(client.AgentId); 3082 appearance = new AvatarAppearance();
3083 return; 3083 return;
3084 } 3084 }
3085 3085
@@ -3087,7 +3087,7 @@ namespace OpenSim.Region.Framework.Scenes
3087 if (appearance == null) 3087 if (appearance == null)
3088 { 3088 {
3089 m_log.DebugFormat("[APPEARANCE]: Appearance not found in {0}, returning default", RegionInfo.RegionName); 3089 m_log.DebugFormat("[APPEARANCE]: Appearance not found in {0}, returning default", RegionInfo.RegionName);
3090 appearance = new AvatarAppearance(client.AgentId); 3090 appearance = new AvatarAppearance();
3091 } 3091 }
3092 } 3092 }
3093 3093
@@ -3553,11 +3553,12 @@ namespace OpenSim.Region.Framework.Scenes
3553 3553
3554 if (AuthorizationService != null) 3554 if (AuthorizationService != null)
3555 { 3555 {
3556 if (!AuthorizationService.IsAuthorizedForRegion(agent.AgentID.ToString(), RegionInfo.RegionID.ToString(),out reason)) 3556 if (!AuthorizationService.IsAuthorizedForRegion(
3557 agent.AgentID.ToString(), agent.firstname, agent.lastname, RegionInfo.RegionID.ToString(), out reason))
3557 { 3558 {
3558 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the region", 3559 m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the region",
3559 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName); 3560 agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
3560 //reason = String.Format("You are not currently on the access list for {0}",RegionInfo.RegionName); 3561
3561 return false; 3562 return false;
3562 } 3563 }
3563 } 3564 }
@@ -3880,8 +3881,11 @@ namespace OpenSim.Region.Framework.Scenes
3880 } 3881 }
3881 3882
3882 /// <summary> 3883 /// <summary>
3883 /// Tries to teleport agent to other region. 3884 /// Tries to teleport agent to another region.
3884 /// </summary> 3885 /// </summary>
3886 /// <remarks>
3887 /// The region name must exactly match that given.
3888 /// </remarks>
3885 /// <param name="remoteClient"></param> 3889 /// <param name="remoteClient"></param>
3886 /// <param name="regionName"></param> 3890 /// <param name="regionName"></param>
3887 /// <param name="position"></param> 3891 /// <param name="position"></param>
@@ -3890,15 +3894,16 @@ namespace OpenSim.Region.Framework.Scenes
3890 public void RequestTeleportLocation(IClientAPI remoteClient, string regionName, Vector3 position, 3894 public void RequestTeleportLocation(IClientAPI remoteClient, string regionName, Vector3 position,
3891 Vector3 lookat, uint teleportFlags) 3895 Vector3 lookat, uint teleportFlags)
3892 { 3896 {
3893 List<GridRegion> regions = GridService.GetRegionsByName(RegionInfo.ScopeID, regionName, 1); 3897 GridRegion region = GridService.GetRegionByName(RegionInfo.ScopeID, regionName);
3894 if (regions == null || regions.Count == 0) 3898
3899 if (region == null)
3895 { 3900 {
3896 // can't find the region: Tell viewer and abort 3901 // can't find the region: Tell viewer and abort
3897 remoteClient.SendTeleportFailed("The region '" + regionName + "' could not be found."); 3902 remoteClient.SendTeleportFailed("The region '" + regionName + "' could not be found.");
3898 return; 3903 return;
3899 } 3904 }
3900 3905
3901 RequestTeleportLocation(remoteClient, regions[0].RegionHandle, position, lookat, teleportFlags); 3906 RequestTeleportLocation(remoteClient, region.RegionHandle, position, lookat, teleportFlags);
3902 } 3907 }
3903 3908
3904 /// <summary> 3909 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index b6fb5a4..57baa99 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1650,16 +1650,7 @@ namespace OpenSim.Region.Framework.Scenes
1650 ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar); 1650 ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar);
1651 if (avatar != null) 1651 if (avatar != null)
1652 { 1652 {
1653 List<string> coords = new List<string>(); 1653 avatar.MoveToTarget(target);
1654 uint regionX = 0;
1655 uint regionY = 0;
1656 Utils.LongToUInts(Scene.RegionInfo.RegionHandle, out regionX, out regionY);
1657 target.X += regionX;
1658 target.Y += regionY;
1659 coords.Add(target.X.ToString());
1660 coords.Add(target.Y.ToString());
1661 coords.Add(target.Z.ToString());
1662 avatar.DoMoveToPosition(avatar, "", coords);
1663 } 1654 }
1664 } 1655 }
1665 else 1656 else
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 4629757..90ad34e 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1038,7 +1038,7 @@ namespace OpenSim.Region.Framework.Scenes
1038 { 1038 {
1039 actor.Size = m_shape.Scale; 1039 actor.Size = m_shape.Scale;
1040 1040
1041 if (((OpenMetaverse.SculptType)Shape.SculptType) == SculptType.Mesh) 1041 if (Shape.SculptEntry)
1042 CheckSculptAndLoad(); 1042 CheckSculptAndLoad();
1043 else 1043 else
1044 ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); 1044 ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
@@ -1751,96 +1751,111 @@ namespace OpenSim.Region.Framework.Scenes
1751 return part; 1751 return part;
1752 } 1752 }
1753 1753
1754 public void DoPhysicsPropertyUpdate(bool UsePhysics, bool isNew) 1754 /// <summary>
1755 /// Do a physics property update for a NINJA joint.
1756 /// </summary>
1757 /// <param name="UsePhysics"></param>
1758 /// <param name="isNew"></param>
1759 protected void DoPhysicsPropertyUpdateForNinjaJoint(bool UsePhysics, bool isNew)
1755 { 1760 {
1756 if (IsJoint()) 1761 if (UsePhysics)
1757 { 1762 {
1758 if (UsePhysics) 1763 // by turning a joint proxy object physical, we cause creation of a joint in the ODE scene.
1759 { 1764 // note that, as a special case, joints have no bodies or geoms in the physics scene, even though they are physical.
1760 // by turning a joint proxy object physical, we cause creation of a joint in the ODE scene.
1761 // note that, as a special case, joints have no bodies or geoms in the physics scene, even though they are physical.
1762 1765
1763 PhysicsJointType jointType; 1766 PhysicsJointType jointType;
1764 if (IsHingeJoint()) 1767 if (IsHingeJoint())
1765 { 1768 {
1766 jointType = PhysicsJointType.Hinge; 1769 jointType = PhysicsJointType.Hinge;
1767 } 1770 }
1768 else if (IsBallJoint()) 1771 else if (IsBallJoint())
1769 { 1772 {
1770 jointType = PhysicsJointType.Ball; 1773 jointType = PhysicsJointType.Ball;
1771 } 1774 }
1772 else 1775 else
1773 { 1776 {
1774 jointType = PhysicsJointType.Ball; 1777 jointType = PhysicsJointType.Ball;
1775 } 1778 }
1776 1779
1777 List<string> bodyNames = new List<string>(); 1780 List<string> bodyNames = new List<string>();
1778 string RawParams = Description; 1781 string RawParams = Description;
1779 string[] jointParams = RawParams.Split(" ".ToCharArray(), System.StringSplitOptions.RemoveEmptyEntries); 1782 string[] jointParams = RawParams.Split(" ".ToCharArray(), System.StringSplitOptions.RemoveEmptyEntries);
1780 string trackedBodyName = null; 1783 string trackedBodyName = null;
1781 if (jointParams.Length >= 2) 1784 if (jointParams.Length >= 2)
1785 {
1786 for (int iBodyName = 0; iBodyName < 2; iBodyName++)
1782 { 1787 {
1783 for (int iBodyName = 0; iBodyName < 2; iBodyName++) 1788 string bodyName = jointParams[iBodyName];
1789 bodyNames.Add(bodyName);
1790 if (bodyName != "NULL")
1784 { 1791 {
1785 string bodyName = jointParams[iBodyName]; 1792 if (trackedBodyName == null)
1786 bodyNames.Add(bodyName);
1787 if (bodyName != "NULL")
1788 { 1793 {
1789 if (trackedBodyName == null) 1794 trackedBodyName = bodyName;
1790 {
1791 trackedBodyName = bodyName;
1792 }
1793 } 1795 }
1794 } 1796 }
1795 } 1797 }
1798 }
1796 1799
1797 SceneObjectPart trackedBody = m_parentGroup.Scene.GetSceneObjectPart(trackedBodyName); // FIXME: causes a sequential lookup 1800 SceneObjectPart trackedBody = m_parentGroup.Scene.GetSceneObjectPart(trackedBodyName); // FIXME: causes a sequential lookup
1798 Quaternion localRotation = Quaternion.Identity; 1801 Quaternion localRotation = Quaternion.Identity;
1799 if (trackedBody != null) 1802 if (trackedBody != null)
1800 { 1803 {
1801 localRotation = Quaternion.Inverse(trackedBody.RotationOffset) * this.RotationOffset; 1804 localRotation = Quaternion.Inverse(trackedBody.RotationOffset) * this.RotationOffset;
1802 } 1805 }
1803 else 1806 else
1804 { 1807 {
1805 // error, output it below 1808 // error, output it below
1806 } 1809 }
1807 1810
1808 PhysicsJoint joint; 1811 PhysicsJoint joint;
1809 1812
1810 joint = m_parentGroup.Scene.PhysicsScene.RequestJointCreation(Name, jointType, 1813 joint = m_parentGroup.Scene.PhysicsScene.RequestJointCreation(Name, jointType,
1811 AbsolutePosition, 1814 AbsolutePosition,
1812 this.RotationOffset, 1815 this.RotationOffset,
1813 Description, 1816 Description,
1814 bodyNames, 1817 bodyNames,
1815 trackedBodyName, 1818 trackedBodyName,
1816 localRotation); 1819 localRotation);
1817 1820
1818 if (trackedBody == null) 1821 if (trackedBody == null)
1819 { 1822 {
1820 ParentGroup.Scene.jointErrorMessage(joint, "warning: tracked body name not found! joint location will not be updated properly. joint: " + Name); 1823 ParentGroup.Scene.jointErrorMessage(joint, "warning: tracked body name not found! joint location will not be updated properly. joint: " + Name);
1821 } 1824 }
1825 }
1826 else
1827 {
1828 if (isNew)
1829 {
1830 // if the joint proxy is new, and it is not physical, do nothing. There is no joint in ODE to
1831 // delete, and if we try to delete it, due to asynchronous processing, the deletion request
1832 // will get processed later at an indeterminate time, which could cancel a later-arriving
1833 // joint creation request.
1822 } 1834 }
1823 else 1835 else
1824 { 1836 {
1825 if (isNew) 1837 // here we turn off the joint object, so remove the joint from the physics scene
1826 { 1838 m_parentGroup.Scene.PhysicsScene.RequestJointDeletion(Name); // FIXME: what if the name changed?
1827 // if the joint proxy is new, and it is not physical, do nothing. There is no joint in ODE to
1828 // delete, and if we try to delete it, due to asynchronous processing, the deletion request
1829 // will get processed later at an indeterminate time, which could cancel a later-arriving
1830 // joint creation request.
1831 }
1832 else
1833 {
1834 // here we turn off the joint object, so remove the joint from the physics scene
1835 m_parentGroup.Scene.PhysicsScene.RequestJointDeletion(Name); // FIXME: what if the name changed?
1836 1839
1837 // make sure client isn't interpolating the joint proxy object 1840 // make sure client isn't interpolating the joint proxy object
1838 Velocity = Vector3.Zero; 1841 Velocity = Vector3.Zero;
1839 AngularVelocity = Vector3.Zero; 1842 AngularVelocity = Vector3.Zero;
1840 Acceleration = Vector3.Zero; 1843 Acceleration = Vector3.Zero;
1841 }
1842 } 1844 }
1843 } 1845 }
1846 }
1847
1848 /// <summary>
1849 /// Do a physics propery update for this part.
1850 /// </summary>
1851 /// <param name="UsePhysics"></param>
1852 /// <param name="isNew"></param>
1853 public void DoPhysicsPropertyUpdate(bool UsePhysics, bool isNew)
1854 {
1855 if (IsJoint())
1856 {
1857 DoPhysicsPropertyUpdateForNinjaJoint(UsePhysics, isNew);
1858 }
1844 else 1859 else
1845 { 1860 {
1846 if (PhysActor != null) 1861 if (PhysActor != null)
@@ -1906,7 +1921,7 @@ namespace OpenSim.Region.Framework.Scenes
1906 1921
1907 // If this part is a sculpt then delay the physics update until we've asynchronously loaded the 1922 // If this part is a sculpt then delay the physics update until we've asynchronously loaded the
1908 // mesh data. 1923 // mesh data.
1909 if (((OpenMetaverse.SculptType)Shape.SculptType) == SculptType.Mesh) 1924 if (Shape.SculptEntry)
1910 CheckSculptAndLoad(); 1925 CheckSculptAndLoad();
1911 else 1926 else
1912 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor); 1927 m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
@@ -4821,7 +4836,6 @@ namespace OpenSim.Region.Framework.Scenes
4821 { 4836 {
4822 PhysActor.OnCollisionUpdate += PhysicsCollision; 4837 PhysActor.OnCollisionUpdate += PhysicsCollision;
4823 PhysActor.SubscribeEvents(1000); 4838 PhysActor.SubscribeEvents(1000);
4824
4825 } 4839 }
4826 } 4840 }
4827 else 4841 else
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 83b761c..d354c0a 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -89,6 +89,13 @@ namespace OpenSim.Region.Framework.Scenes
89 /// </summary> 89 /// </summary>
90 private static readonly Vector3 SIT_TARGET_ADJUSTMENT = new Vector3(0.1f, 0.0f, 0.3f); 90 private static readonly Vector3 SIT_TARGET_ADJUSTMENT = new Vector3(0.1f, 0.0f, 0.3f);
91 91
92 /// <summary>
93 /// Movement updates for agents in neighboring regions are sent directly to clients.
94 /// This value only affects how often agent positions are sent to neighbor regions
95 /// for things such as distance-based update prioritization
96 /// </summary>
97 public static readonly float SIGNIFICANT_MOVEMENT = 2.0f;
98
92 public UUID currentParcelUUID = UUID.Zero; 99 public UUID currentParcelUUID = UUID.Zero;
93 100
94 private ISceneViewer m_sceneViewer; 101 private ISceneViewer m_sceneViewer;
@@ -116,7 +123,7 @@ namespace OpenSim.Region.Framework.Scenes
116 private ScriptControlled IgnoredControls = ScriptControlled.CONTROL_ZERO; 123 private ScriptControlled IgnoredControls = ScriptControlled.CONTROL_ZERO;
117 private ScriptControlled LastCommands = ScriptControlled.CONTROL_ZERO; 124 private ScriptControlled LastCommands = ScriptControlled.CONTROL_ZERO;
118 private bool MouseDown = false; 125 private bool MouseDown = false;
119 private SceneObjectGroup proxyObjectGroup; 126// private SceneObjectGroup proxyObjectGroup;
120 //private SceneObjectPart proxyObjectPart = null; 127 //private SceneObjectPart proxyObjectPart = null;
121 public Vector3 lastKnownAllowedPosition; 128 public Vector3 lastKnownAllowedPosition;
122 public bool sentMessageAboutRestrictedParcelFlyingDown; 129 public bool sentMessageAboutRestrictedParcelFlyingDown;
@@ -210,8 +217,8 @@ namespace OpenSim.Region.Framework.Scenes
210 private string m_nextSitAnimation = String.Empty; 217 private string m_nextSitAnimation = String.Empty;
211 218
212 //PauPaw:Proper PID Controler for autopilot************ 219 //PauPaw:Proper PID Controler for autopilot************
213 private bool m_moveToPositionInProgress; 220 public bool MovingToTarget { get; private set; }
214 private Vector3 m_moveToPositionTarget; 221 public Vector3 MoveToPositionTarget { get; private set; }
215 222
216 private bool m_followCamAuto; 223 private bool m_followCamAuto;
217 224
@@ -779,8 +786,7 @@ namespace OpenSim.Region.Framework.Scenes
779 m_controllingClient.OnStartAnim += HandleStartAnim; 786 m_controllingClient.OnStartAnim += HandleStartAnim;
780 m_controllingClient.OnStopAnim += HandleStopAnim; 787 m_controllingClient.OnStopAnim += HandleStopAnim;
781 m_controllingClient.OnForceReleaseControls += HandleForceReleaseControls; 788 m_controllingClient.OnForceReleaseControls += HandleForceReleaseControls;
782 m_controllingClient.OnAutoPilotGo += DoAutoPilot; 789 m_controllingClient.OnAutoPilotGo += MoveToTarget;
783 m_controllingClient.AddGenericPacketHandler("autopilot", DoMoveToPosition);
784 790
785 // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange); 791 // ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange);
786 // ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement); 792 // ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement);
@@ -916,7 +922,7 @@ namespace OpenSim.Region.Framework.Scenes
916 { 922 {
917 m_log.ErrorFormat("[SCENE PRESENCE]: null appearance in MakeRoot in {0}", Scene.RegionInfo.RegionName); 923 m_log.ErrorFormat("[SCENE PRESENCE]: null appearance in MakeRoot in {0}", Scene.RegionInfo.RegionName);
918 // emergency; this really shouldn't happen 924 // emergency; this really shouldn't happen
919 m_appearance = new AvatarAppearance(UUID); 925 m_appearance = new AvatarAppearance();
920 } 926 }
921 927
922 AddToPhysicalScene(isFlying); 928 AddToPhysicalScene(isFlying);
@@ -1076,13 +1082,6 @@ namespace OpenSim.Region.Framework.Scenes
1076 SendTerseUpdateToAllClients(); 1082 SendTerseUpdateToAllClients();
1077 } 1083 }
1078 1084
1079 /// <summary>
1080 ///
1081 /// </summary>
1082 public void StopMovement()
1083 {
1084 }
1085
1086 public void StopFlying() 1085 public void StopFlying()
1087 { 1086 {
1088 ControllingClient.StopFlying(this); 1087 ControllingClient.StopFlying(this);
@@ -1378,15 +1377,15 @@ namespace OpenSim.Region.Framework.Scenes
1378 { 1377 {
1379 return; 1378 return;
1380 } 1379 }
1381
1382 bool update_movementflag = false;
1383 1380
1384 if (m_allowMovement && !SitGround) 1381 if (m_allowMovement && !SitGround)
1385 { 1382 {
1383 bool update_movementflag = false;
1384
1386 if (agentData.UseClientAgentPosition) 1385 if (agentData.UseClientAgentPosition)
1387 { 1386 {
1388 m_moveToPositionInProgress = (agentData.ClientAgentPosition - AbsolutePosition).Length() > 0.2f; 1387 MovingToTarget = (agentData.ClientAgentPosition - AbsolutePosition).Length() > 0.2f;
1389 m_moveToPositionTarget = agentData.ClientAgentPosition; 1388 MoveToPositionTarget = agentData.ClientAgentPosition;
1390 } 1389 }
1391 1390
1392 int i = 0; 1391 int i = 0;
@@ -1417,7 +1416,6 @@ namespace OpenSim.Region.Framework.Scenes
1417 if (m_parentID == 0) 1416 if (m_parentID == 0)
1418 { 1417 {
1419 bool bAllowUpdateMoveToPosition = false; 1418 bool bAllowUpdateMoveToPosition = false;
1420 bool bResetMoveToPosition = false;
1421 1419
1422 Vector3[] dirVectors; 1420 Vector3[] dirVectors;
1423 1421
@@ -1430,13 +1428,14 @@ namespace OpenSim.Region.Framework.Scenes
1430 1428
1431 // The fact that m_movementflag is a byte needs to be fixed 1429 // The fact that m_movementflag is a byte needs to be fixed
1432 // it really should be a uint 1430 // it really should be a uint
1431 // A DIR_CONTROL_FLAG occurs when the user is trying to move in a particular direction.
1433 uint nudgehack = 250; 1432 uint nudgehack = 250;
1434 foreach (Dir_ControlFlags DCF in DIR_CONTROL_FLAGS) 1433 foreach (Dir_ControlFlags DCF in DIR_CONTROL_FLAGS)
1435 { 1434 {
1436 if (((uint)flags & (uint)DCF) != 0) 1435 if (((uint)flags & (uint)DCF) != 0)
1437 { 1436 {
1438 bResetMoveToPosition = true;
1439 DCFlagKeyPressed = true; 1437 DCFlagKeyPressed = true;
1438
1440 try 1439 try
1441 { 1440 {
1442 agent_control_v3 += dirVectors[i]; 1441 agent_control_v3 += dirVectors[i];
@@ -1480,97 +1479,22 @@ namespace OpenSim.Region.Framework.Scenes
1480 bAllowUpdateMoveToPosition = true; 1479 bAllowUpdateMoveToPosition = true;
1481 } 1480 }
1482 } 1481 }
1483 i++;
1484 }
1485 1482
1486 //Paupaw:Do Proper PID for Autopilot here 1483 i++;
1487 if (bResetMoveToPosition)
1488 {
1489 m_moveToPositionTarget = Vector3.Zero;
1490 m_moveToPositionInProgress = false;
1491 update_movementflag = true;
1492 bAllowUpdateMoveToPosition = false;
1493 } 1484 }
1494 1485
1495 if (bAllowUpdateMoveToPosition && (m_moveToPositionInProgress && !m_autopilotMoving)) 1486 if (MovingToTarget)
1496 { 1487 {
1497 //Check the error term of the current position in relation to the target position 1488 // If the user has pressed a key then we want to cancel any move to target.
1498 if (Util.GetDistanceTo(AbsolutePosition, m_moveToPositionTarget) <= 0.5f) 1489 if (DCFlagKeyPressed)
1499 { 1490 {
1500 // we are close enough to the target 1491 ResetMoveToTarget();
1501 m_moveToPositionTarget = Vector3.Zero;
1502 m_moveToPositionInProgress = false;
1503 update_movementflag = true; 1492 update_movementflag = true;
1504 } 1493 }
1505 else 1494 else if (bAllowUpdateMoveToPosition)
1506 { 1495 {
1507 try 1496 if (HandleMoveToTargetUpdate(ref agent_control_v3, bodyRotation))
1508 { 1497 update_movementflag = true;
1509 // move avatar in 2D at one meter/second towards target, in avatar coordinate frame.
1510 // This movement vector gets added to the velocity through AddNewMovement().
1511 // Theoretically we might need a more complex PID approach here if other
1512 // unknown forces are acting on the avatar and we need to adaptively respond
1513 // to such forces, but the following simple approach seems to works fine.
1514 Vector3 LocalVectorToTarget3D =
1515 (m_moveToPositionTarget - AbsolutePosition) // vector from cur. pos to target in global coords
1516 * Matrix4.CreateFromQuaternion(Quaternion.Inverse(bodyRotation)); // change to avatar coords
1517 // Ignore z component of vector
1518 Vector3 LocalVectorToTarget2D = new Vector3((float)(LocalVectorToTarget3D.X), (float)(LocalVectorToTarget3D.Y), 0f);
1519 LocalVectorToTarget2D.Normalize();
1520 agent_control_v3 += LocalVectorToTarget2D;
1521
1522 // update avatar movement flags. the avatar coordinate system is as follows:
1523 //
1524 // +X (forward)
1525 //
1526 // ^
1527 // |
1528 // |
1529 // |
1530 // |
1531 // (left) +Y <--------o--------> -Y
1532 // avatar
1533 // |
1534 // |
1535 // |
1536 // |
1537 // v
1538 // -X
1539 //
1540
1541 // based on the above avatar coordinate system, classify the movement into
1542 // one of left/right/back/forward.
1543 if (LocalVectorToTarget2D.Y > 0)//MoveLeft
1544 {
1545 m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT;
1546 //AgentControlFlags
1547 AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT;
1548 update_movementflag = true;
1549 }
1550 else if (LocalVectorToTarget2D.Y < 0) //MoveRight
1551 {
1552 m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT;
1553 AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT;
1554 update_movementflag = true;
1555 }
1556 if (LocalVectorToTarget2D.X < 0) //MoveBack
1557 {
1558 m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK;
1559 AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK;
1560 update_movementflag = true;
1561 }
1562 else if (LocalVectorToTarget2D.X > 0) //Move Forward
1563 {
1564 m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD;
1565 AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD;
1566 update_movementflag = true;
1567 }
1568 }
1569 catch (Exception e)
1570 {
1571 //Avoid system crash, can be slower but...
1572 m_log.DebugFormat("Crash! {0}", e.ToString());
1573 }
1574 } 1498 }
1575 } 1499 }
1576 } 1500 }
@@ -1608,74 +1532,208 @@ namespace OpenSim.Region.Framework.Scenes
1608 // "In {0} adding velocity to {1} of {2}", m_scene.RegionInfo.RegionName, Name, agent_control_v3); 1532 // "In {0} adding velocity to {1} of {2}", m_scene.RegionInfo.RegionName, Name, agent_control_v3);
1609 1533
1610 AddNewMovement(agent_control_v3, q); 1534 AddNewMovement(agent_control_v3, q);
1611
1612
1613 } 1535 }
1614 }
1615 1536
1616 if (update_movementflag && ((flags & AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) == 0) && (m_parentID == 0) && !SitGround) 1537 if (update_movementflag
1617 Animator.UpdateMovementAnimations(); 1538 && ((flags & AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) == 0)
1539 && (m_parentID == 0)
1540 && !SitGround)
1541 Animator.UpdateMovementAnimations();
1542 }
1618 1543
1619 m_scene.EventManager.TriggerOnClientMovement(this); 1544 m_scene.EventManager.TriggerOnClientMovement(this);
1620 1545
1621 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); 1546 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
1622 } 1547 }
1623 1548
1624 public void DoAutoPilot(uint not_used, Vector3 Pos, IClientAPI remote_client) 1549 /// <summary>
1550 /// Calculate an update to move the presence to the set target.
1551 /// </summary>
1552 /// <remarks>
1553 /// This doesn't actually perform the movement. Instead, it adds its vector to agent_control_v3.
1554 /// </remarks>
1555 /// <param value="agent_control_v3">Cumulative agent movement that this method will update.</param>
1556 /// <param value="bodyRotation">New body rotation of the avatar.</param>
1557 /// <returns>True if movement has been updated in some way. False otherwise.</returns>
1558 public bool HandleMoveToTargetUpdate(ref Vector3 agent_control_v3, Quaternion bodyRotation)
1625 { 1559 {
1626 m_autopilotMoving = true; 1560// m_log.DebugFormat("[SCENE PRESENCE]: Called HandleMoveToTargetUpdate() for {0}", Name);
1627 m_autoPilotTarget = Pos;
1628 m_sitAtAutoTarget = false;
1629 PrimitiveBaseShape proxy = PrimitiveBaseShape.Default;
1630 //proxy.PCode = (byte)PCode.ParticleSystem;
1631 1561
1632 proxyObjectGroup = new SceneObjectGroup(UUID, Pos, Rotation, proxy); 1562 bool updated = false;
1633 proxyObjectGroup.AttachToScene(m_scene);
1634
1635 // Commented out this code since it could never have executed, but might still be informative.
1636// if (proxyObjectGroup != null)
1637// {
1638 proxyObjectGroup.SendGroupFullUpdate();
1639 remote_client.SendSitResponse(proxyObjectGroup.UUID, Vector3.Zero, Quaternion.Identity, true, Vector3.Zero, Vector3.Zero, false);
1640 m_scene.DeleteSceneObject(proxyObjectGroup, false);
1641// }
1642// else
1643// {
1644// m_autopilotMoving = false;
1645// m_autoPilotTarget = Vector3.Zero;
1646// ControllingClient.SendAlertMessage("Autopilot cancelled");
1647// }
1648 }
1649 1563
1650 public void DoMoveToPosition(Object sender, string method, List<String> args) 1564// m_log.DebugFormat(
1651 { 1565// "[SCENE PRESENCE]: bAllowUpdateMoveToPosition {0}, m_moveToPositionInProgress {1}, m_autopilotMoving {2}",
1652 try 1566// allowUpdate, m_moveToPositionInProgress, m_autopilotMoving);
1567
1568 if (!m_autopilotMoving)
1653 { 1569 {
1654 float locx = 0f; 1570 double distanceToTarget = Util.GetDistanceTo(AbsolutePosition, MoveToPositionTarget);
1655 float locy = 0f; 1571// m_log.DebugFormat(
1656 float locz = 0f; 1572// "[SCENE PRESENCE]: Abs pos of {0} is {1}, target {2}, distance {3}",
1657 uint regionX = 0; 1573// Name, AbsolutePosition, MoveToPositionTarget, distanceToTarget);
1658 uint regionY = 0; 1574
1659 try 1575 // Check the error term of the current position in relation to the target position
1576 if (distanceToTarget <= 1)
1660 { 1577 {
1661 Utils.LongToUInts(Scene.RegionInfo.RegionHandle, out regionX, out regionY); 1578 // We are close enough to the target
1662 locx = Convert.ToSingle(args[0]) - (float)regionX; 1579 AbsolutePosition = MoveToPositionTarget;
1663 locy = Convert.ToSingle(args[1]) - (float)regionY; 1580 ResetMoveToTarget();
1664 locz = Convert.ToSingle(args[2]); 1581 updated = true;
1665 } 1582 }
1666 catch (InvalidCastException) 1583 else
1667 { 1584 {
1668 m_log.Error("[CLIENT]: Invalid autopilot request"); 1585 try
1669 return; 1586 {
1587 // move avatar in 3D at one meter/second towards target, in avatar coordinate frame.
1588 // This movement vector gets added to the velocity through AddNewMovement().
1589 // Theoretically we might need a more complex PID approach here if other
1590 // unknown forces are acting on the avatar and we need to adaptively respond
1591 // to such forces, but the following simple approach seems to works fine.
1592 Vector3 LocalVectorToTarget3D =
1593 (MoveToPositionTarget - AbsolutePosition) // vector from cur. pos to target in global coords
1594 * Matrix4.CreateFromQuaternion(Quaternion.Inverse(bodyRotation)); // change to avatar coords
1595 // Ignore z component of vector
1596// Vector3 LocalVectorToTarget2D = new Vector3((float)(LocalVectorToTarget3D.X), (float)(LocalVectorToTarget3D.Y), 0f);
1597 LocalVectorToTarget3D.Normalize();
1598
1599 // update avatar movement flags. the avatar coordinate system is as follows:
1600 //
1601 // +X (forward)
1602 //
1603 // ^
1604 // |
1605 // |
1606 // |
1607 // |
1608 // (left) +Y <--------o--------> -Y
1609 // avatar
1610 // |
1611 // |
1612 // |
1613 // |
1614 // v
1615 // -X
1616 //
1617
1618 // based on the above avatar coordinate system, classify the movement into
1619 // one of left/right/back/forward.
1620 if (LocalVectorToTarget3D.X < 0) //MoveBack
1621 {
1622 m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK;
1623 AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK;
1624 updated = true;
1625 }
1626 else if (LocalVectorToTarget3D.X > 0) //Move Forward
1627 {
1628 m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD;
1629 AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD;
1630 updated = true;
1631 }
1632
1633 if (LocalVectorToTarget3D.Y > 0) //MoveLeft
1634 {
1635 m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT;
1636 AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT;
1637 updated = true;
1638 }
1639 else if (LocalVectorToTarget3D.Y < 0) //MoveRight
1640 {
1641 m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT;
1642 AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT;
1643 updated = true;
1644 }
1645
1646 if (LocalVectorToTarget3D.Z > 0) //Up
1647 {
1648 // Don't set these flags for up or down - doing so will make the avatar crouch or
1649 // keep trying to jump even if walking along level ground
1650 //m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_UP;
1651 //AgentControlFlags
1652 //AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_UP;
1653 updated = true;
1654 }
1655 else if (LocalVectorToTarget3D.Z < 0) //Down
1656 {
1657 //m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN;
1658 //AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN;
1659 updated = true;
1660 }
1661
1662// m_log.DebugFormat(
1663// "[SCENE PRESENCE]: HandleMoveToTargetUpdate adding {0} to move vector {1} for {2}",
1664// LocalVectorToTarget3D, agent_control_v3, Name);
1665
1666 agent_control_v3 += LocalVectorToTarget3D;
1667 }
1668 catch (Exception e)
1669 {
1670 //Avoid system crash, can be slower but...
1671 m_log.DebugFormat("Crash! {0}", e.ToString());
1672 }
1670 } 1673 }
1671 m_moveToPositionInProgress = true;
1672 m_moveToPositionTarget = new Vector3(locx, locy, locz);
1673 }
1674 catch (Exception ex)
1675 {
1676 //Why did I get this error?
1677 m_log.Error("[SCENEPRESENCE]: DoMoveToPosition" + ex);
1678 } 1674 }
1675
1676 return updated;
1677 }
1678
1679 /// <summary>
1680 /// Move to the given target over time.
1681 /// </summary>
1682 /// <param name="pos"></param>
1683 public void MoveToTarget(Vector3 pos)
1684 {
1685// m_log.DebugFormat(
1686// "[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}",
1687// Name, pos, m_scene.RegionInfo.RegionName);
1688
1689 if (pos.X < 0 || pos.X >= Constants.RegionSize
1690 || pos.Y < 0 || pos.Y >= Constants.RegionSize
1691 || pos.Z < 0)
1692 return;
1693
1694// Vector3 heightAdjust = new Vector3(0, 0, Appearance.AvatarHeight / 2);
1695// pos += heightAdjust;
1696//
1697// // Anti duck-walking measure
1698// if (Math.Abs(pos.Z - AbsolutePosition.Z) < 0.2f)
1699// {
1700//// m_log.DebugFormat("[SCENE PRESENCE]: Adjusting MoveToPosition from {0} to {1}", pos, AbsolutePosition);
1701// pos.Z = AbsolutePosition.Z;
1702// }
1703
1704 float terrainHeight = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y];
1705 pos.Z = Math.Max(terrainHeight, pos.Z);
1706
1707 // Fudge factor. It appears that if one clicks "go here" on a piece of ground, the go here request is
1708 // always slightly higher than the actual terrain height.
1709 // FIXME: This constrains NOC movements as well, so should be somewhere else.
1710 if (pos.Z - terrainHeight < 0.2)
1711 pos.Z = terrainHeight;
1712
1713 m_log.DebugFormat(
1714 "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}",
1715 Name, pos, terrainHeight, m_scene.RegionInfo.RegionName);
1716
1717 if (pos.Z > terrainHeight)
1718 PhysicsActor.Flying = true;
1719
1720 MovingToTarget = true;
1721 MoveToPositionTarget = pos;
1722
1723 Vector3 agent_control_v3 = new Vector3();
1724 HandleMoveToTargetUpdate(ref agent_control_v3, Rotation);
1725 AddNewMovement(agent_control_v3, Rotation);
1726 }
1727
1728 /// <summary>
1729 /// Reset the move to target.
1730 /// </summary>
1731 public void ResetMoveToTarget()
1732 {
1733 m_log.DebugFormat("[SCENE PRESENCE]: Resetting move to target for {0}", Name);
1734
1735 MovingToTarget = false;
1736 MoveToPositionTarget = Vector3.Zero;
1679 } 1737 }
1680 1738
1681 private void CheckAtSitTarget() 1739 private void CheckAtSitTarget()
@@ -1832,7 +1890,7 @@ namespace OpenSim.Region.Framework.Scenes
1832 bool forceMouselook = false; 1890 bool forceMouselook = false;
1833 1891
1834 //SceneObjectPart part = m_scene.GetSceneObjectPart(targetID); 1892 //SceneObjectPart part = m_scene.GetSceneObjectPart(targetID);
1835 SceneObjectPart part = FindNextAvailableSitTarget(targetID); 1893 SceneObjectPart part = FindNextAvailableSitTarget(targetID);
1836 if (part != null) 1894 if (part != null)
1837 { 1895 {
1838 // TODO: determine position to sit at based on scene geometry; don't trust offset from client 1896 // TODO: determine position to sit at based on scene geometry; don't trust offset from client
@@ -1908,14 +1966,23 @@ namespace OpenSim.Region.Framework.Scenes
1908 HandleAgentSit(remoteClient, UUID); 1966 HandleAgentSit(remoteClient, UUID);
1909 } 1967 }
1910 1968
1969 // public void HandleAgentRequestSit(IClientAPI remoteClient, UUID agentID, UUID targetID, Vector3 offset, string sitAnimation)
1911 public void HandleAgentRequestSit(IClientAPI remoteClient, UUID agentID, UUID targetID, Vector3 offset) 1970 public void HandleAgentRequestSit(IClientAPI remoteClient, UUID agentID, UUID targetID, Vector3 offset)
1912 { 1971 {
1913 if (m_parentID != 0) 1972 if (m_parentID != 0)
1914 { 1973 {
1915 StandUp(); 1974 StandUp();
1916 } 1975 }
1976
1977// if (!String.IsNullOrEmpty(sitAnimation))
1978// {
1979// m_nextSitAnimation = sitAnimation;
1980// }
1981// else
1982// {
1917 m_nextSitAnimation = "SIT"; 1983 m_nextSitAnimation = "SIT";
1918 1984// }
1985
1919 //SceneObjectPart part = m_scene.GetSceneObjectPart(targetID); 1986 //SceneObjectPart part = m_scene.GetSceneObjectPart(targetID);
1920 SceneObjectPart part = FindNextAvailableSitTarget(targetID); 1987 SceneObjectPart part = FindNextAvailableSitTarget(targetID);
1921 1988
@@ -1940,7 +2007,6 @@ namespace OpenSim.Region.Framework.Scenes
1940 } 2007 }
1941 else 2008 else
1942 { 2009 {
1943
1944 m_log.Warn("Sit requested on unknown object: " + targetID.ToString()); 2010 m_log.Warn("Sit requested on unknown object: " + targetID.ToString());
1945 } 2011 }
1946 2012
@@ -2138,44 +2204,7 @@ namespace OpenSim.Region.Framework.Scenes
2138 SendSitResponse(ControllingClient, m_requestedSitTargetUUID, collisionPoint - m_requestedSitOffset, Quaternion.Identity); 2204 SendSitResponse(ControllingClient, m_requestedSitTargetUUID, collisionPoint - m_requestedSitOffset, Quaternion.Identity);
2139 } 2205 }
2140 */ 2206 */
2141 public void HandleAgentRequestSit(IClientAPI remoteClient, UUID agentID, UUID targetID, Vector3 offset, string sitAnimation)
2142 {
2143 if (m_parentID != 0)
2144 {
2145 StandUp();
2146 }
2147 if (!String.IsNullOrEmpty(sitAnimation))
2148 {
2149 m_nextSitAnimation = sitAnimation;
2150 }
2151 else
2152 {
2153 m_nextSitAnimation = "SIT";
2154 }
2155
2156 //SceneObjectPart part = m_scene.GetSceneObjectPart(targetID);
2157 SceneObjectPart part = FindNextAvailableSitTarget(targetID);
2158 if (part != null)
2159 {
2160 m_requestedSitTargetID = part.LocalId;
2161 //m_requestedSitOffset = offset;
2162 m_requestedSitTargetUUID = targetID;
2163 2207
2164 m_log.DebugFormat("[SIT]: Client requested Sit Position: {0}", offset);
2165
2166 if (m_scene.PhysicsScene.SupportsRayCast())
2167 {
2168 //SitRayCastAvatarPosition(part);
2169 //return;
2170 }
2171 }
2172 else
2173 {
2174 m_log.Warn("Sit requested on unknown object: " + targetID);
2175 }
2176
2177 SendSitResponse(remoteClient, targetID, offset, Quaternion.Identity);
2178 }
2179 2208
2180 public void HandleAgentSit(IClientAPI remoteClient, UUID agentID) 2209 public void HandleAgentSit(IClientAPI remoteClient, UUID agentID)
2181 { 2210 {
@@ -2647,10 +2676,11 @@ namespace OpenSim.Region.Framework.Scenes
2647 /// <param name="avatar"></param> 2676 /// <param name="avatar"></param>
2648 public void SendAppearanceToAgent(ScenePresence avatar) 2677 public void SendAppearanceToAgent(ScenePresence avatar)
2649 { 2678 {
2650// m_log.WarnFormat("[SP] Send appearance from {0} to {1}",m_uuid,avatar.ControllingClient.AgentId); 2679// m_log.DebugFormat(
2680// "[SCENE PRESENCE] Send appearance from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID);
2651 2681
2652 avatar.ControllingClient.SendAppearance( 2682 avatar.ControllingClient.SendAppearance(
2653 m_appearance.Owner, m_appearance.VisualParams, m_appearance.Texture.GetBytes()); 2683 UUID, m_appearance.VisualParams, m_appearance.Texture.GetBytes());
2654 } 2684 }
2655 2685
2656 // Because appearance setting is in a module, we actually need 2686 // Because appearance setting is in a module, we actually need
@@ -2659,7 +2689,11 @@ namespace OpenSim.Region.Framework.Scenes
2659 public AvatarAppearance Appearance 2689 public AvatarAppearance Appearance
2660 { 2690 {
2661 get { return m_appearance; } 2691 get { return m_appearance; }
2662 set { m_appearance = value; } 2692 set
2693 {
2694 m_appearance = value;
2695// m_log.DebugFormat("[SCENE PRESENCE]: Set appearance for {0} to {1}", Name, value);
2696 }
2663 } 2697 }
2664 2698
2665 #endregion 2699 #endregion
@@ -2671,15 +2705,10 @@ namespace OpenSim.Region.Framework.Scenes
2671 /// </summary> 2705 /// </summary>
2672 protected void CheckForSignificantMovement() 2706 protected void CheckForSignificantMovement()
2673 { 2707 {
2674 // Movement updates for agents in neighboring regions are sent directly to clients.
2675 // This value only affects how often agent positions are sent to neighbor regions
2676 // for things such as distance-based update prioritization
2677 const float SIGNIFICANT_MOVEMENT = 2.0f;
2678
2679 if (Util.GetDistanceTo(AbsolutePosition, posLastSignificantMove) > SIGNIFICANT_MOVEMENT) 2708 if (Util.GetDistanceTo(AbsolutePosition, posLastSignificantMove) > SIGNIFICANT_MOVEMENT)
2680 { 2709 {
2681 posLastSignificantMove = AbsolutePosition; 2710 posLastSignificantMove = AbsolutePosition;
2682 m_scene.EventManager.TriggerSignificantClientMovement(m_controllingClient); 2711 m_scene.EventManager.TriggerSignificantClientMovement(this);
2683 } 2712 }
2684 2713
2685 // Minimum Draw distance is 64 meters, the Radius of the draw distance sphere is 32m 2714 // Minimum Draw distance is 64 meters, the Radius of the draw distance sphere is 32m
diff --git a/OpenSim/Region/Framework/Scenes/UndoState.cs b/OpenSim/Region/Framework/Scenes/UndoState.cs
index 393f42d..d34d8e5 100644
--- a/OpenSim/Region/Framework/Scenes/UndoState.cs
+++ b/OpenSim/Region/Framework/Scenes/UndoState.cs
@@ -35,7 +35,7 @@ namespace OpenSim.Region.Framework.Scenes
35{ 35{
36 public class UndoState 36 public class UndoState
37 { 37 {
38 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 38// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
39 39
40 public Vector3 Position = Vector3.Zero; 40 public Vector3 Position = Vector3.Zero;
41 public Vector3 Scale = Vector3.Zero; 41 public Vector3 Scale = Vector3.Zero;