From aadc4eb3b8d1c4a30cee7b69efac9197a974f45b Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 22 Jul 2011 19:23:38 +0100
Subject: Fix problem where sculpts were not getting physical proxies
Fixed this by inspecting Shape.SculptEntry at various places instead of Shape.SculptType. Sculpties actually have a SculptType of Cylinder - only true mesh is SculptType.Mesh
This addresses http://opensimulator.org/mantis/view.php?id=5595
---
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 4629757..5791b95 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1038,7 +1038,7 @@ namespace OpenSim.Region.Framework.Scenes
{
actor.Size = m_shape.Scale;
- if (((OpenMetaverse.SculptType)Shape.SculptType) == SculptType.Mesh)
+ if (Shape.SculptEntry)
CheckSculptAndLoad();
else
ParentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
@@ -1906,7 +1906,7 @@ namespace OpenSim.Region.Framework.Scenes
// If this part is a sculpt then delay the physics update until we've asynchronously loaded the
// mesh data.
- if (((OpenMetaverse.SculptType)Shape.SculptType) == SculptType.Mesh)
+ if (Shape.SculptEntry)
CheckSculptAndLoad();
else
m_parentGroup.Scene.PhysicsScene.AddPhysicsActorTaint(PhysActor);
--
cgit v1.1
From 667b54f5a2a04fa5a2859397868d270eab3913f1 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 23 Jul 2011 01:59:14 +0100
Subject: Don't load current/next/everyone/base permissions from the library
item xml files - always use PermissionMask.All instead (which was the
existing default).
Library items always need the same permissions, so it doesn't make sense to load them from the xml files. This just opens the door to permissions mistakes.
---
OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region/Framework')
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
newName = item.Name;
}
- if (remoteClient.AgentId == oldAgentID || (LibraryService != null && LibraryService.LibraryRootFolder != null && oldAgentID == LibraryService.LibraryRootFolder.Owner))
+ if (remoteClient.AgentId == oldAgentID
+ || (LibraryService != null
+ && LibraryService.LibraryRootFolder != null
+ && oldAgentID == LibraryService.LibraryRootFolder.Owner))
{
CreateNewInventoryItem(
remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Flags, callbackID, asset, (sbyte)item.InvType,
--
cgit v1.1
From fcaa4f601231a6feb7fd5ea40e35fba6220c6235 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 23 Jul 2011 02:05:51 +0100
Subject: Revert "Don't load current/next/everyone/base permissions from the
library item xml files - always use PermissionMask.All instead (which was the
existing default)."
There actually are uses for this. I will correct the perms instead since some entries appear to be wrong.
This reverts commit 667b54f5a2a04fa5a2859397868d270eab3913f1.
---
OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index afc1a4f..30421d4 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -724,10 +724,7 @@ namespace OpenSim.Region.Framework.Scenes
newName = item.Name;
}
- if (remoteClient.AgentId == oldAgentID
- || (LibraryService != null
- && LibraryService.LibraryRootFolder != null
- && oldAgentID == LibraryService.LibraryRootFolder.Owner))
+ if (remoteClient.AgentId == oldAgentID || (LibraryService != null && LibraryService.LibraryRootFolder != null && oldAgentID == LibraryService.LibraryRootFolder.Owner))
{
CreateNewInventoryItem(
remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Flags, callbackID, asset, (sbyte)item.InvType,
--
cgit v1.1
From f0895028e96e39ca179cad8c103042397ad870e5 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 23 Jul 2011 02:13:11 +0100
Subject: Remove manually permissions settings on all current library items so
that they use the defaults instead.
Some items had completely wrong permissions - this is easier than correcting them all.
The ability to set permissions in xml is retained since there are use cases for this (e.g. to create no-mod library scripts)
---
OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region/Framework')
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
newName = item.Name;
}
- if (remoteClient.AgentId == oldAgentID || (LibraryService != null && LibraryService.LibraryRootFolder != null && oldAgentID == LibraryService.LibraryRootFolder.Owner))
+ if (remoteClient.AgentId == oldAgentID
+ || (LibraryService != null
+ && LibraryService.LibraryRootFolder != null
+ && oldAgentID == LibraryService.LibraryRootFolder.Owner))
{
CreateNewInventoryItem(
remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Flags, callbackID, asset, (sbyte)item.InvType,
--
cgit v1.1
From 504de8bc4792eda165d71a2c7481cb43cb92759a Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 23 Jul 2011 03:46:55 +0100
Subject: Pass the first name and last name from the agent circuit data to the
authorization service rather than from the account.
This is to accomodate situations where the authorization service is being used by the hypergrid, where visitors have no user account.
See http://opensimulator.org/mantis/view.php?id=5517, this code is somewhat adapted/cleaned up from Michelle's patch
I'm a little ambivalent about this since visitors could put anything in firstname/lastname so it's not much of an auth measure.
It's up to the auth service to decide which data it actually uses.
Possibly we should be passing through other info such as agent circuit ip
---
OpenSim/Region/Framework/Scenes/Scene.cs | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 32a2887..1a32510 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3553,11 +3553,12 @@ namespace OpenSim.Region.Framework.Scenes
if (AuthorizationService != null)
{
- if (!AuthorizationService.IsAuthorizedForRegion(agent.AgentID.ToString(), RegionInfo.RegionID.ToString(),out reason))
+ if (!AuthorizationService.IsAuthorizedForRegion(
+ agent.AgentID.ToString(), agent.firstname, agent.lastname, RegionInfo.RegionID.ToString(), out reason))
{
m_log.WarnFormat("[CONNECTION BEGIN]: Denied access to: {0} ({1} {2}) at {3} because the user does not have access to the region",
agent.AgentID, agent.firstname, agent.lastname, RegionInfo.RegionName);
- //reason = String.Format("You are not currently on the access list for {0}",RegionInfo.RegionName);
+
return false;
}
}
--
cgit v1.1
From 8c3eb324c4b666e7abadef4a714d1bd8d5f71ac2 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 29 Jul 2011 00:00:35 +0100
Subject: When using osTeleportAgent() and osTeleportAvatar(), only teleport if
the region name exactly matches (not near matches)
This is to prevent situations where the first name returned by GridService.GetRegionsByName is not one that exactly matches the given region name, even when there is an exact match later on in the list.
Only the above two functions call this teleport method (the map uses a different routine) so this seems safe to change.
Addresses http://opensimulator.org/mantis/view.php?id=5606
---
OpenSim/Region/Framework/Scenes/Scene.cs | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 1a32510..b84c3d5 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3881,8 +3881,11 @@ namespace OpenSim.Region.Framework.Scenes
}
///
- /// Tries to teleport agent to other region.
+ /// Tries to teleport agent to another region.
///
+ ///
+ /// The region name must exactly match that given.
+ ///
///
///
///
@@ -3891,15 +3894,16 @@ namespace OpenSim.Region.Framework.Scenes
public void RequestTeleportLocation(IClientAPI remoteClient, string regionName, Vector3 position,
Vector3 lookat, uint teleportFlags)
{
- List regions = GridService.GetRegionsByName(RegionInfo.ScopeID, regionName, 1);
- if (regions == null || regions.Count == 0)
+ GridRegion region = GridService.GetRegionByName(RegionInfo.ScopeID, regionName);
+
+ if (region == null)
{
// can't find the region: Tell viewer and abort
remoteClient.SendTeleportFailed("The region '" + regionName + "' could not be found.");
return;
}
- RequestTeleportLocation(remoteClient, regions[0].RegionHandle, position, lookat, teleportFlags);
+ RequestTeleportLocation(remoteClient, region.RegionHandle, position, lookat, teleportFlags);
}
///
--
cgit v1.1
From d917010433dda944dd1f6a7afcb827937804e805 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sat, 30 Jul 2011 03:11:36 +0100
Subject: minor: Add method doc to collision subscription methods. Change
method case to reflect OpenSim standards.
---
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 1 -
1 file changed, 1 deletion(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 5791b95..58fc6fc 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -4821,7 +4821,6 @@ namespace OpenSim.Region.Framework.Scenes
{
PhysActor.OnCollisionUpdate += PhysicsCollision;
PhysActor.SubscribeEvents(1000);
-
}
}
else
--
cgit v1.1
From aea700753361621f25a3e22f4176fcd2cc981b9f Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sun, 31 Jul 2011 02:50:50 +0100
Subject: refactor: split out ninja joint part of SOP.DoPhysicsPropertyUpdate()
so that we don't have to look at it if it's not relevant
---
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 157 +++++++++++----------
1 file changed, 86 insertions(+), 71 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 58fc6fc..7c9636a 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1751,96 +1751,111 @@ namespace OpenSim.Region.Framework.Scenes
return part;
}
- public void DoPhysicsPropertyUpdate(bool UsePhysics, bool isNew)
+ ///
+ /// Do a physics property update for a NINJA joint.
+ ///
+ ///
+ ///
+ protected void DoPhysicsPropertyUpdateForNinjaJoint(bool UsePhysics, bool isNew)
{
- if (IsJoint())
+ if (UsePhysics)
{
- if (UsePhysics)
- {
- // by turning a joint proxy object physical, we cause creation of a joint in the ODE scene.
- // note that, as a special case, joints have no bodies or geoms in the physics scene, even though they are physical.
+ // by turning a joint proxy object physical, we cause creation of a joint in the ODE scene.
+ // note that, as a special case, joints have no bodies or geoms in the physics scene, even though they are physical.
- PhysicsJointType jointType;
- if (IsHingeJoint())
- {
- jointType = PhysicsJointType.Hinge;
- }
- else if (IsBallJoint())
- {
- jointType = PhysicsJointType.Ball;
- }
- else
- {
- jointType = PhysicsJointType.Ball;
- }
+ PhysicsJointType jointType;
+ if (IsHingeJoint())
+ {
+ jointType = PhysicsJointType.Hinge;
+ }
+ else if (IsBallJoint())
+ {
+ jointType = PhysicsJointType.Ball;
+ }
+ else
+ {
+ jointType = PhysicsJointType.Ball;
+ }
- List bodyNames = new List();
- string RawParams = Description;
- string[] jointParams = RawParams.Split(" ".ToCharArray(), System.StringSplitOptions.RemoveEmptyEntries);
- string trackedBodyName = null;
- if (jointParams.Length >= 2)
+ List bodyNames = new List();
+ string RawParams = Description;
+ string[] jointParams = RawParams.Split(" ".ToCharArray(), System.StringSplitOptions.RemoveEmptyEntries);
+ string trackedBodyName = null;
+ if (jointParams.Length >= 2)
+ {
+ for (int iBodyName = 0; iBodyName < 2; iBodyName++)
{
- for (int iBodyName = 0; iBodyName < 2; iBodyName++)
+ string bodyName = jointParams[iBodyName];
+ bodyNames.Add(bodyName);
+ if (bodyName != "NULL")
{
- string bodyName = jointParams[iBodyName];
- bodyNames.Add(bodyName);
- if (bodyName != "NULL")
+ if (trackedBodyName == null)
{
- if (trackedBodyName == null)
- {
- trackedBodyName = bodyName;
- }
+ trackedBodyName = bodyName;
}
}
}
+ }
- SceneObjectPart trackedBody = m_parentGroup.Scene.GetSceneObjectPart(trackedBodyName); // FIXME: causes a sequential lookup
- Quaternion localRotation = Quaternion.Identity;
- if (trackedBody != null)
- {
- localRotation = Quaternion.Inverse(trackedBody.RotationOffset) * this.RotationOffset;
- }
- else
- {
- // error, output it below
- }
+ SceneObjectPart trackedBody = m_parentGroup.Scene.GetSceneObjectPart(trackedBodyName); // FIXME: causes a sequential lookup
+ Quaternion localRotation = Quaternion.Identity;
+ if (trackedBody != null)
+ {
+ localRotation = Quaternion.Inverse(trackedBody.RotationOffset) * this.RotationOffset;
+ }
+ else
+ {
+ // error, output it below
+ }
- PhysicsJoint joint;
+ PhysicsJoint joint;
- joint = m_parentGroup.Scene.PhysicsScene.RequestJointCreation(Name, jointType,
- AbsolutePosition,
- this.RotationOffset,
- Description,
- bodyNames,
- trackedBodyName,
- localRotation);
+ joint = m_parentGroup.Scene.PhysicsScene.RequestJointCreation(Name, jointType,
+ AbsolutePosition,
+ this.RotationOffset,
+ Description,
+ bodyNames,
+ trackedBodyName,
+ localRotation);
- if (trackedBody == null)
- {
- ParentGroup.Scene.jointErrorMessage(joint, "warning: tracked body name not found! joint location will not be updated properly. joint: " + Name);
- }
+ if (trackedBody == null)
+ {
+ ParentGroup.Scene.jointErrorMessage(joint, "warning: tracked body name not found! joint location will not be updated properly. joint: " + Name);
+ }
+ }
+ else
+ {
+ if (isNew)
+ {
+ // if the joint proxy is new, and it is not physical, do nothing. There is no joint in ODE to
+ // delete, and if we try to delete it, due to asynchronous processing, the deletion request
+ // will get processed later at an indeterminate time, which could cancel a later-arriving
+ // joint creation request.
}
else
{
- if (isNew)
- {
- // if the joint proxy is new, and it is not physical, do nothing. There is no joint in ODE to
- // delete, and if we try to delete it, due to asynchronous processing, the deletion request
- // will get processed later at an indeterminate time, which could cancel a later-arriving
- // joint creation request.
- }
- else
- {
- // here we turn off the joint object, so remove the joint from the physics scene
- m_parentGroup.Scene.PhysicsScene.RequestJointDeletion(Name); // FIXME: what if the name changed?
+ // here we turn off the joint object, so remove the joint from the physics scene
+ m_parentGroup.Scene.PhysicsScene.RequestJointDeletion(Name); // FIXME: what if the name changed?
- // make sure client isn't interpolating the joint proxy object
- Velocity = Vector3.Zero;
- AngularVelocity = Vector3.Zero;
- Acceleration = Vector3.Zero;
- }
+ // make sure client isn't interpolating the joint proxy object
+ Velocity = Vector3.Zero;
+ AngularVelocity = Vector3.Zero;
+ Acceleration = Vector3.Zero;
}
}
+ }
+
+ ///
+ /// Do a physics propery update for this part.
+ ///
+ ///
+ ///
+ public void DoPhysicsPropertyUpdate(bool UsePhysics, bool isNew)
+ {
+ if (IsJoint())
+ {
+ DoPhysicsPropertyUpdateForNinjaJoint(UsePhysics, isNew);
+ }
else
{
if (PhysActor != null)
@@ -4699,7 +4714,7 @@ namespace OpenSim.Region.Framework.Scenes
///
public void CheckSculptAndLoad()
{
-// m_log.DebugFormat("Processing CheckSculptAndLoad for {0} {1}", Name, LocalId);
+ m_log.DebugFormat("Processing CheckSculptAndLoad for {0} {1}", Name, LocalId);
if (ParentGroup.IsDeleted)
return;
--
cgit v1.1
From b757583662e75380d70e7462a3b0f6a6d6732a02 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Sun, 31 Jul 2011 03:41:35 +0100
Subject: Comment out SOP logging message I accidentally left in
---
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 7c9636a..90ad34e 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -4714,7 +4714,7 @@ namespace OpenSim.Region.Framework.Scenes
///
public void CheckSculptAndLoad()
{
- m_log.DebugFormat("Processing CheckSculptAndLoad for {0} {1}", Name, LocalId);
+// m_log.DebugFormat("Processing CheckSculptAndLoad for {0} {1}", Name, LocalId);
if (ParentGroup.IsDeleted)
return;
--
cgit v1.1
From 59f548cda82facef003fb7309180412254a234a1 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 1 Aug 2011 23:41:29 +0100
Subject: Get osNpcCreate appearance working with avatars that are currently in
the scene.
Had to stop using AvatarService for now since it doesn't store baked texture IDs (which is why this was failing).
Also failing because cloning appearance was also cloning the AvatarApperance.Owner field, which we weren't then changing.
Extended TestCreate() to check this.
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 83b761c..1e121d9 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2647,7 +2647,8 @@ namespace OpenSim.Region.Framework.Scenes
///
public void SendAppearanceToAgent(ScenePresence avatar)
{
-// m_log.WarnFormat("[SP] Send appearance from {0} to {1}",m_uuid,avatar.ControllingClient.AgentId);
+// m_log.DebugFormat(
+// "[SCENE PRESENCE] Send appearance from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID);
avatar.ControllingClient.SendAppearance(
m_appearance.Owner, m_appearance.VisualParams, m_appearance.Texture.GetBytes());
@@ -2659,7 +2660,11 @@ namespace OpenSim.Region.Framework.Scenes
public AvatarAppearance Appearance
{
get { return m_appearance; }
- set { m_appearance = value; }
+ set
+ {
+ m_appearance = value;
+// m_log.DebugFormat("[SCENE PRESENCE]: Set appearance for {0} to {1}", Name, value);
+ }
}
#endregion
--
cgit v1.1
From b6ac1c46cd473b129b70344f0001f1e8f97d8860 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 2 Aug 2011 00:13:04 +0100
Subject: Get rid of AvatarAppearance.Owner to simplify the code.
This is not used for anything - appearances are always properties of objects with ids (ScenePresence, AgentCircuitData) and just has the potential to get out of sync when the appearance is cloned.
---
OpenSim/Region/Framework/Scenes/Scene.cs | 4 ++--
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index b84c3d5..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
if (aCircuit == null)
{
m_log.DebugFormat("[APPEARANCE] Client did not supply a circuit. Non-Linden? Creating default appearance.");
- appearance = new AvatarAppearance(client.AgentId);
+ appearance = new AvatarAppearance();
return;
}
@@ -3087,7 +3087,7 @@ namespace OpenSim.Region.Framework.Scenes
if (appearance == null)
{
m_log.DebugFormat("[APPEARANCE]: Appearance not found in {0}, returning default", RegionInfo.RegionName);
- appearance = new AvatarAppearance(client.AgentId);
+ appearance = new AvatarAppearance();
}
}
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 1e121d9..4739f5b 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -916,7 +916,7 @@ namespace OpenSim.Region.Framework.Scenes
{
m_log.ErrorFormat("[SCENE PRESENCE]: null appearance in MakeRoot in {0}", Scene.RegionInfo.RegionName);
// emergency; this really shouldn't happen
- m_appearance = new AvatarAppearance(UUID);
+ m_appearance = new AvatarAppearance();
}
AddToPhysicalScene(isFlying);
@@ -2651,7 +2651,7 @@ namespace OpenSim.Region.Framework.Scenes
// "[SCENE PRESENCE] Send appearance from {0} {1} to {2} {3}", Name, m_uuid, avatar.Name, avatar.UUID);
avatar.ControllingClient.SendAppearance(
- m_appearance.Owner, m_appearance.VisualParams, m_appearance.Texture.GetBytes());
+ UUID, m_appearance.VisualParams, m_appearance.Texture.GetBytes());
}
// Because appearance setting is in a module, we actually need
--
cgit v1.1
From c122489e0947300753281e88771b7a74d49869c7 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 2 Aug 2011 23:41:12 +0100
Subject: Partially fix autopilot/go here
This now works again except that it requires a click or avatar mvmt to get going
This is because the ScenePresence.HandleAgentUpdate() method doesn't trigger until the client does something significant, at which point autopilot takes over.
Even clicking is enough to trigger.
This will be improved presently.
---
.../Region/Framework/Scenes/SceneObjectGroup.cs | 11 +-
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 112 ++++++++++-----------
OpenSim/Region/Framework/Scenes/UndoState.cs | 2 +-
3 files changed, 53 insertions(+), 72 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index b6fb5a4..1417efb 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1650,16 +1650,7 @@ namespace OpenSim.Region.Framework.Scenes
ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar);
if (avatar != null)
{
- List coords = new List();
- uint regionX = 0;
- uint regionY = 0;
- Utils.LongToUInts(Scene.RegionInfo.RegionHandle, out regionX, out regionY);
- target.X += regionX;
- target.Y += regionY;
- coords.Add(target.X.ToString());
- coords.Add(target.Y.ToString());
- coords.Add(target.Z.ToString());
- avatar.DoMoveToPosition(avatar, "", coords);
+ avatar.DoMoveToPosition(0, target, null);
}
}
else
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 4739f5b..a508813 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -116,7 +116,7 @@ namespace OpenSim.Region.Framework.Scenes
private ScriptControlled IgnoredControls = ScriptControlled.CONTROL_ZERO;
private ScriptControlled LastCommands = ScriptControlled.CONTROL_ZERO;
private bool MouseDown = false;
- private SceneObjectGroup proxyObjectGroup;
+// private SceneObjectGroup proxyObjectGroup;
//private SceneObjectPart proxyObjectPart = null;
public Vector3 lastKnownAllowedPosition;
public bool sentMessageAboutRestrictedParcelFlyingDown;
@@ -779,8 +779,7 @@ namespace OpenSim.Region.Framework.Scenes
m_controllingClient.OnStartAnim += HandleStartAnim;
m_controllingClient.OnStopAnim += HandleStopAnim;
m_controllingClient.OnForceReleaseControls += HandleForceReleaseControls;
- m_controllingClient.OnAutoPilotGo += DoAutoPilot;
- m_controllingClient.AddGenericPacketHandler("autopilot", DoMoveToPosition);
+ m_controllingClient.OnAutoPilotGo += DoMoveToPosition;
// ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange);
// ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement);
@@ -1480,6 +1479,7 @@ namespace OpenSim.Region.Framework.Scenes
bAllowUpdateMoveToPosition = true;
}
}
+
i++;
}
@@ -1492,12 +1492,21 @@ namespace OpenSim.Region.Framework.Scenes
bAllowUpdateMoveToPosition = false;
}
+ m_log.DebugFormat(
+ "[SCENE PRESENCE]: bAllowUpdateMoveToPosition {0}, m_moveToPositionInProgress {1}, m_autopilotMoving {2}",
+ bAllowUpdateMoveToPosition, m_moveToPositionInProgress, m_autopilotMoving);
+
if (bAllowUpdateMoveToPosition && (m_moveToPositionInProgress && !m_autopilotMoving))
{
- //Check the error term of the current position in relation to the target position
- if (Util.GetDistanceTo(AbsolutePosition, m_moveToPositionTarget) <= 0.5f)
+ double distanceToTarget = Util.GetDistanceTo(AbsolutePosition, m_moveToPositionTarget);
+// m_log.DebugFormat(
+// "[SCENE PRESENCE]: Abs pos of {0} is {1}, target {2}, distance {3}",
+// Name, AbsolutePosition, m_moveToPositionTarget, distanceToTarget);
+
+ // Check the error term of the current position in relation to the target position
+ if (distanceToTarget <= 1)
{
- // we are close enough to the target
+ // We are close enough to the target
m_moveToPositionTarget = Vector3.Zero;
m_moveToPositionInProgress = false;
update_movementflag = true;
@@ -1608,8 +1617,6 @@ namespace OpenSim.Region.Framework.Scenes
// "In {0} adding velocity to {1} of {2}", m_scene.RegionInfo.RegionName, Name, agent_control_v3);
AddNewMovement(agent_control_v3, q);
-
-
}
}
@@ -1621,61 +1628,44 @@ namespace OpenSim.Region.Framework.Scenes
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
}
- public void DoAutoPilot(uint not_used, Vector3 Pos, IClientAPI remote_client)
- {
- m_autopilotMoving = true;
- m_autoPilotTarget = Pos;
- m_sitAtAutoTarget = false;
- PrimitiveBaseShape proxy = PrimitiveBaseShape.Default;
- //proxy.PCode = (byte)PCode.ParticleSystem;
+// public void DoAutoPilot(uint not_used, Vector3 Pos, IClientAPI remote_client)
+// {
+// m_autopilotMoving = true;
+// m_autoPilotTarget = Pos;
+// m_sitAtAutoTarget = false;
+// PrimitiveBaseShape proxy = PrimitiveBaseShape.Default;
+// //proxy.PCode = (byte)PCode.ParticleSystem;
+//
+// proxyObjectGroup = new SceneObjectGroup(UUID, Pos, Rotation, proxy);
+// proxyObjectGroup.AttachToScene(m_scene);
+//
+// // Commented out this code since it could never have executed, but might still be informative.
+//// if (proxyObjectGroup != null)
+//// {
+// proxyObjectGroup.SendGroupFullUpdate();
+// remote_client.SendSitResponse(proxyObjectGroup.UUID, Vector3.Zero, Quaternion.Identity, true, Vector3.Zero, Vector3.Zero, false);
+// m_scene.DeleteSceneObject(proxyObjectGroup, false);
+//// }
+//// else
+//// {
+//// m_autopilotMoving = false;
+//// m_autoPilotTarget = Vector3.Zero;
+//// ControllingClient.SendAlertMessage("Autopilot cancelled");
+//// }
+// }
- proxyObjectGroup = new SceneObjectGroup(UUID, Pos, Rotation, proxy);
- proxyObjectGroup.AttachToScene(m_scene);
-
- // Commented out this code since it could never have executed, but might still be informative.
-// if (proxyObjectGroup != null)
-// {
- proxyObjectGroup.SendGroupFullUpdate();
- remote_client.SendSitResponse(proxyObjectGroup.UUID, Vector3.Zero, Quaternion.Identity, true, Vector3.Zero, Vector3.Zero, false);
- m_scene.DeleteSceneObject(proxyObjectGroup, false);
-// }
-// else
-// {
-// m_autopilotMoving = false;
-// m_autoPilotTarget = Vector3.Zero;
-// ControllingClient.SendAlertMessage("Autopilot cancelled");
-// }
- }
-
- public void DoMoveToPosition(Object sender, string method, List args)
+ ///
+ /// Move this presence to the given position over time.
+ ///
+ ///
+ public void DoMoveToPosition(uint not_used, Vector3 pos, IClientAPI remote_client)
{
- try
- {
- float locx = 0f;
- float locy = 0f;
- float locz = 0f;
- uint regionX = 0;
- uint regionY = 0;
- try
- {
- Utils.LongToUInts(Scene.RegionInfo.RegionHandle, out regionX, out regionY);
- locx = Convert.ToSingle(args[0]) - (float)regionX;
- locy = Convert.ToSingle(args[1]) - (float)regionY;
- locz = Convert.ToSingle(args[2]);
- }
- catch (InvalidCastException)
- {
- m_log.Error("[CLIENT]: Invalid autopilot request");
- return;
- }
- m_moveToPositionInProgress = true;
- m_moveToPositionTarget = new Vector3(locx, locy, locz);
- }
- catch (Exception ex)
- {
- //Why did I get this error?
- m_log.Error("[SCENEPRESENCE]: DoMoveToPosition" + ex);
- }
+ m_log.DebugFormat(
+ "[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}",
+ Name, pos, m_scene.RegionInfo.RegionName);
+
+ m_moveToPositionInProgress = true;
+ m_moveToPositionTarget = pos;
}
private void CheckAtSitTarget()
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
{
public class UndoState
{
- private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
public Vector3 Position = Vector3.Zero;
public Vector3 Scale = Vector3.Zero;
--
cgit v1.1
From f9689f5cc96a937ba592487102e3a04535ca4739 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 3 Aug 2011 00:46:46 +0100
Subject: refactor: move out code from HandleAgentUpdate() which processes
updates to move to a set position
Also comment out the really spammy log message I accidentally left in on the last commit.
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 214 ++++++++++++-----------
1 file changed, 116 insertions(+), 98 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index a508813..06b27ca 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1483,105 +1483,8 @@ namespace OpenSim.Region.Framework.Scenes
i++;
}
- //Paupaw:Do Proper PID for Autopilot here
- if (bResetMoveToPosition)
- {
- m_moveToPositionTarget = Vector3.Zero;
- m_moveToPositionInProgress = false;
+ if (DoMoveToPositionUpdate(ref agent_control_v3, bodyRotation, bResetMoveToPosition, bAllowUpdateMoveToPosition))
update_movementflag = true;
- bAllowUpdateMoveToPosition = false;
- }
-
- m_log.DebugFormat(
- "[SCENE PRESENCE]: bAllowUpdateMoveToPosition {0}, m_moveToPositionInProgress {1}, m_autopilotMoving {2}",
- bAllowUpdateMoveToPosition, m_moveToPositionInProgress, m_autopilotMoving);
-
- if (bAllowUpdateMoveToPosition && (m_moveToPositionInProgress && !m_autopilotMoving))
- {
- double distanceToTarget = Util.GetDistanceTo(AbsolutePosition, m_moveToPositionTarget);
-// m_log.DebugFormat(
-// "[SCENE PRESENCE]: Abs pos of {0} is {1}, target {2}, distance {3}",
-// Name, AbsolutePosition, m_moveToPositionTarget, distanceToTarget);
-
- // Check the error term of the current position in relation to the target position
- if (distanceToTarget <= 1)
- {
- // We are close enough to the target
- m_moveToPositionTarget = Vector3.Zero;
- m_moveToPositionInProgress = false;
- update_movementflag = true;
- }
- else
- {
- try
- {
- // move avatar in 2D at one meter/second towards target, in avatar coordinate frame.
- // This movement vector gets added to the velocity through AddNewMovement().
- // Theoretically we might need a more complex PID approach here if other
- // unknown forces are acting on the avatar and we need to adaptively respond
- // to such forces, but the following simple approach seems to works fine.
- Vector3 LocalVectorToTarget3D =
- (m_moveToPositionTarget - AbsolutePosition) // vector from cur. pos to target in global coords
- * Matrix4.CreateFromQuaternion(Quaternion.Inverse(bodyRotation)); // change to avatar coords
- // Ignore z component of vector
- Vector3 LocalVectorToTarget2D = new Vector3((float)(LocalVectorToTarget3D.X), (float)(LocalVectorToTarget3D.Y), 0f);
- LocalVectorToTarget2D.Normalize();
- agent_control_v3 += LocalVectorToTarget2D;
-
- // update avatar movement flags. the avatar coordinate system is as follows:
- //
- // +X (forward)
- //
- // ^
- // |
- // |
- // |
- // |
- // (left) +Y <--------o--------> -Y
- // avatar
- // |
- // |
- // |
- // |
- // v
- // -X
- //
-
- // based on the above avatar coordinate system, classify the movement into
- // one of left/right/back/forward.
- if (LocalVectorToTarget2D.Y > 0)//MoveLeft
- {
- m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT;
- //AgentControlFlags
- AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT;
- update_movementflag = true;
- }
- else if (LocalVectorToTarget2D.Y < 0) //MoveRight
- {
- m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT;
- AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT;
- update_movementflag = true;
- }
- if (LocalVectorToTarget2D.X < 0) //MoveBack
- {
- m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK;
- AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK;
- update_movementflag = true;
- }
- else if (LocalVectorToTarget2D.X > 0) //Move Forward
- {
- m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD;
- AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD;
- update_movementflag = true;
- }
- }
- catch (Exception e)
- {
- //Avoid system crash, can be slower but...
- m_log.DebugFormat("Crash! {0}", e.ToString());
- }
- }
- }
}
// Cause the avatar to stop flying if it's colliding
@@ -1628,6 +1531,121 @@ namespace OpenSim.Region.Framework.Scenes
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
}
+ ///
+ /// Process moving the avatar if a position has been set.
+ ///
+ /// Cumulative agent movement that this method will update.
+ /// New body rotation of the avatar.
+ /// If true, clear the move to position
+ /// If true, allow the update in principle.
+ /// True if movement has been updated in some way. False otherwise.
+ protected bool DoMoveToPositionUpdate(
+ ref Vector3 agent_control_v3, Quaternion bodyRotation, bool reset, bool allowUpdate)
+ {
+ bool updated = false;
+
+ //Paupaw:Do Proper PID for Autopilot here
+ if (reset)
+ {
+ m_moveToPositionTarget = Vector3.Zero;
+ m_moveToPositionInProgress = false;
+ updated = true;
+ }
+
+ m_log.DebugFormat(
+ "[SCENE PRESENCE]: bAllowUpdateMoveToPosition {0}, m_moveToPositionInProgress {1}, m_autopilotMoving {2}",
+ allowUpdate, m_moveToPositionInProgress, m_autopilotMoving);
+
+ if (allowUpdate && (m_moveToPositionInProgress && !m_autopilotMoving))
+ {
+ double distanceToTarget = Util.GetDistanceTo(AbsolutePosition, m_moveToPositionTarget);
+// m_log.DebugFormat(
+// "[SCENE PRESENCE]: Abs pos of {0} is {1}, target {2}, distance {3}",
+// Name, AbsolutePosition, m_moveToPositionTarget, distanceToTarget);
+
+ // Check the error term of the current position in relation to the target position
+ if (distanceToTarget <= 1)
+ {
+ // We are close enough to the target
+ m_moveToPositionTarget = Vector3.Zero;
+ m_moveToPositionInProgress = false;
+ updated = true;
+ }
+ else
+ {
+ try
+ {
+ // move avatar in 2D at one meter/second towards target, in avatar coordinate frame.
+ // This movement vector gets added to the velocity through AddNewMovement().
+ // Theoretically we might need a more complex PID approach here if other
+ // unknown forces are acting on the avatar and we need to adaptively respond
+ // to such forces, but the following simple approach seems to works fine.
+ Vector3 LocalVectorToTarget3D =
+ (m_moveToPositionTarget - AbsolutePosition) // vector from cur. pos to target in global coords
+ * Matrix4.CreateFromQuaternion(Quaternion.Inverse(bodyRotation)); // change to avatar coords
+ // Ignore z component of vector
+ Vector3 LocalVectorToTarget2D = new Vector3((float)(LocalVectorToTarget3D.X), (float)(LocalVectorToTarget3D.Y), 0f);
+ LocalVectorToTarget2D.Normalize();
+ agent_control_v3 += LocalVectorToTarget2D;
+
+ // update avatar movement flags. the avatar coordinate system is as follows:
+ //
+ // +X (forward)
+ //
+ // ^
+ // |
+ // |
+ // |
+ // |
+ // (left) +Y <--------o--------> -Y
+ // avatar
+ // |
+ // |
+ // |
+ // |
+ // v
+ // -X
+ //
+
+ // based on the above avatar coordinate system, classify the movement into
+ // one of left/right/back/forward.
+ if (LocalVectorToTarget2D.Y > 0)//MoveLeft
+ {
+ m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT;
+ //AgentControlFlags
+ AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT;
+ updated = true;
+ }
+ else if (LocalVectorToTarget2D.Y < 0) //MoveRight
+ {
+ m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT;
+ AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT;
+ updated = true;
+ }
+ if (LocalVectorToTarget2D.X < 0) //MoveBack
+ {
+ m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK;
+ AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK;
+ updated = true;
+ }
+ else if (LocalVectorToTarget2D.X > 0) //Move Forward
+ {
+ m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD;
+ AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD;
+ updated = true;
+ }
+ }
+ catch (Exception e)
+ {
+ //Avoid system crash, can be slower but...
+ m_log.DebugFormat("Crash! {0}", e.ToString());
+ }
+ }
+ }
+
+ return updated;
+ }
+
// public void DoAutoPilot(uint not_used, Vector3 Pos, IClientAPI remote_client)
// {
// m_autopilotMoving = true;
--
cgit v1.1
From 1c126e6e222989dc9ce66e65380d120c7ee8d24d Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 3 Aug 2011 00:55:52 +0100
Subject: refactor: Move update_movement_flag and the final check inside the
m_allowMovement if in HandleAgentUpdate() since it's logically only ever used
there
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 06b27ca..7cc6d66 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1377,11 +1377,11 @@ namespace OpenSim.Region.Framework.Scenes
{
return;
}
-
- bool update_movementflag = false;
if (m_allowMovement && !SitGround)
{
+ bool update_movementflag = false;
+
if (agentData.UseClientAgentPosition)
{
m_moveToPositionInProgress = (agentData.ClientAgentPosition - AbsolutePosition).Length() > 0.2f;
@@ -1521,10 +1521,10 @@ namespace OpenSim.Region.Framework.Scenes
AddNewMovement(agent_control_v3, q);
}
- }
- if (update_movementflag && ((flags & AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) == 0) && (m_parentID == 0) && !SitGround)
- Animator.UpdateMovementAnimations();
+ if (update_movementflag && ((flags & AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) == 0) && (m_parentID == 0) && !SitGround)
+ Animator.UpdateMovementAnimations();
+ }
m_scene.EventManager.TriggerOnClientMovement(this);
--
cgit v1.1
From 0c23764ce2f7fd8b697ff493bf50742b9aaf2a6a Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 3 Aug 2011 01:12:32 +0100
Subject: get autopilot/go here to work immediately.
This works with viewer 1.23.5 and so in theory should work with libopenmetaverse.
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 7cc6d66..9c71492 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1552,9 +1552,9 @@ namespace OpenSim.Region.Framework.Scenes
updated = true;
}
- m_log.DebugFormat(
- "[SCENE PRESENCE]: bAllowUpdateMoveToPosition {0}, m_moveToPositionInProgress {1}, m_autopilotMoving {2}",
- allowUpdate, m_moveToPositionInProgress, m_autopilotMoving);
+// m_log.DebugFormat(
+// "[SCENE PRESENCE]: bAllowUpdateMoveToPosition {0}, m_moveToPositionInProgress {1}, m_autopilotMoving {2}",
+// allowUpdate, m_moveToPositionInProgress, m_autopilotMoving);
if (allowUpdate && (m_moveToPositionInProgress && !m_autopilotMoving))
{
@@ -1684,6 +1684,10 @@ namespace OpenSim.Region.Framework.Scenes
m_moveToPositionInProgress = true;
m_moveToPositionTarget = pos;
+
+ Vector3 agent_control_v3 = new Vector3();
+ DoMoveToPositionUpdate(ref agent_control_v3, Rotation, false, true);
+ AddNewMovement(agent_control_v3, Rotation);
}
private void CheckAtSitTarget()
--
cgit v1.1
From 30e816bfa2fe3145a43723dfea6c4765551f5e04 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 3 Aug 2011 02:04:38 +0100
Subject: Implement move to/autopilot for z axis movement as well.
This is jerky (an artifact of the way it's being done, I think), but it's better than on implementation.
---
.../Scenes/Animation/ScenePresenceAnimator.cs | 4 +-
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 53 ++++++++++++++++------
2 files changed, 40 insertions(+), 17 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index 4865481..1334230 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -295,7 +295,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
if (move.X != 0f || move.Y != 0f)
{
// Walking / crouchwalking / running
- if (move.Z < 0f)
+ if (move.Z < 0)
return "CROUCHWALK";
else if (m_scenePresence.SetAlwaysRun)
return "RUN";
@@ -305,7 +305,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
else
{
// Not walking
- if (move.Z < 0f)
+ if (move.Z < 0)
return "CROUCH";
else
return "STAND";
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 9c71492..7b228c6 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1559,9 +1559,9 @@ namespace OpenSim.Region.Framework.Scenes
if (allowUpdate && (m_moveToPositionInProgress && !m_autopilotMoving))
{
double distanceToTarget = Util.GetDistanceTo(AbsolutePosition, m_moveToPositionTarget);
-// m_log.DebugFormat(
-// "[SCENE PRESENCE]: Abs pos of {0} is {1}, target {2}, distance {3}",
-// Name, AbsolutePosition, m_moveToPositionTarget, distanceToTarget);
+ m_log.DebugFormat(
+ "[SCENE PRESENCE]: Abs pos of {0} is {1}, target {2}, distance {3}",
+ Name, AbsolutePosition, m_moveToPositionTarget, distanceToTarget);
// Check the error term of the current position in relation to the target position
if (distanceToTarget <= 1)
@@ -1575,7 +1575,7 @@ namespace OpenSim.Region.Framework.Scenes
{
try
{
- // move avatar in 2D at one meter/second towards target, in avatar coordinate frame.
+ // move avatar in 3D at one meter/second towards target, in avatar coordinate frame.
// This movement vector gets added to the velocity through AddNewMovement().
// Theoretically we might need a more complex PID approach here if other
// unknown forces are acting on the avatar and we need to adaptively respond
@@ -1584,9 +1584,8 @@ namespace OpenSim.Region.Framework.Scenes
(m_moveToPositionTarget - AbsolutePosition) // vector from cur. pos to target in global coords
* Matrix4.CreateFromQuaternion(Quaternion.Inverse(bodyRotation)); // change to avatar coords
// Ignore z component of vector
- Vector3 LocalVectorToTarget2D = new Vector3((float)(LocalVectorToTarget3D.X), (float)(LocalVectorToTarget3D.Y), 0f);
- LocalVectorToTarget2D.Normalize();
- agent_control_v3 += LocalVectorToTarget2D;
+// Vector3 LocalVectorToTarget2D = new Vector3((float)(LocalVectorToTarget3D.X), (float)(LocalVectorToTarget3D.Y), 0f);
+ LocalVectorToTarget3D.Normalize();
// update avatar movement flags. the avatar coordinate system is as follows:
//
@@ -1609,31 +1608,48 @@ namespace OpenSim.Region.Framework.Scenes
// based on the above avatar coordinate system, classify the movement into
// one of left/right/back/forward.
- if (LocalVectorToTarget2D.Y > 0)//MoveLeft
+ if (LocalVectorToTarget3D.X < 0) //MoveBack
+ {
+ m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK;
+ AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK;
+ updated = true;
+ }
+ else if (LocalVectorToTarget3D.X > 0) //Move Forward
+ {
+ m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD;
+ AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD;
+ updated = true;
+ }
+
+ if (LocalVectorToTarget3D.Y > 0) //MoveLeft
{
m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT;
//AgentControlFlags
AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT;
updated = true;
}
- else if (LocalVectorToTarget2D.Y < 0) //MoveRight
+ else if (LocalVectorToTarget3D.Y < 0) //MoveRight
{
m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT;
AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_RIGHT;
updated = true;
}
- if (LocalVectorToTarget2D.X < 0) //MoveBack
+
+ if (LocalVectorToTarget3D.Z > 0) //Up
{
- m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK;
- AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_BACK;
+ m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_UP;
+ //AgentControlFlags
+ AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_UP;
updated = true;
}
- else if (LocalVectorToTarget2D.X > 0) //Move Forward
+ else if (LocalVectorToTarget3D.Z < 0) //Down
{
- m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD;
- AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD;
+ m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN;
+ AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN;
updated = true;
}
+
+ agent_control_v3 += LocalVectorToTarget3D;
}
catch (Exception e)
{
@@ -1682,6 +1698,13 @@ namespace OpenSim.Region.Framework.Scenes
"[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}",
Name, pos, m_scene.RegionInfo.RegionName);
+ Vector3 heightAdjust = new Vector3(0, 0, Appearance.AvatarHeight / 2);
+ pos += heightAdjust;
+
+ // Anti duck-walking measure
+ if (Math.Abs(pos.Z - AbsolutePosition.Z) < 0.2f)
+ pos.Z = AbsolutePosition.Z;
+
m_moveToPositionInProgress = true;
m_moveToPositionTarget = pos;
--
cgit v1.1
From 68a5fe04318fed4b306e8405861203c19a313a2f Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 3 Aug 2011 02:59:49 +0100
Subject: Improve z axis move to/autopilot so the avatar does alternative
crouch/huzzah when walking along the ground
Moving a flying avatar to a ground point doesn't yet land the avatar. This may or may not be the best thing
---
.../Scenes/Animation/ScenePresenceAnimator.cs | 8 ++++-
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 34 +++++++++++++++-------
2 files changed, 30 insertions(+), 12 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index 1334230..4ab818f 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -27,6 +27,8 @@
using System;
using System.Collections.Generic;
+using System.Reflection;
+using log4net;
using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Region.Framework.Interfaces;
@@ -40,6 +42,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
///
public class ScenePresenceAnimator
{
+// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+
public AnimationSet Animations
{
get { return m_animations; }
@@ -262,7 +266,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation
m_animTickFall = 0;
- if (move.Z > 0f)
+ if (move.Z > 0.2f)
{
// Jumping
if (!jumping)
@@ -323,6 +327,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation
public void UpdateMovementAnimations()
{
m_movementAnimation = GetMovementAnimation();
+// m_log.DebugFormat(
+// "[SCENE PRESENCE ANIMATOR]: Got animation {0} for {1}", m_movementAnimation, m_scenePresence.Name);
TrySetMovementAnimation(m_movementAnimation);
}
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 7b228c6..a610b6b 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1522,7 +1522,11 @@ namespace OpenSim.Region.Framework.Scenes
AddNewMovement(agent_control_v3, q);
}
- if (update_movementflag && ((flags & AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) == 0) && (m_parentID == 0) && !SitGround)
+ if (update_movementflag
+ && ((flags & AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) == 0)
+ && (m_parentID == 0)
+ && !SitGround
+ && !m_moveToPositionInProgress)
Animator.UpdateMovementAnimations();
}
@@ -1559,9 +1563,9 @@ namespace OpenSim.Region.Framework.Scenes
if (allowUpdate && (m_moveToPositionInProgress && !m_autopilotMoving))
{
double distanceToTarget = Util.GetDistanceTo(AbsolutePosition, m_moveToPositionTarget);
- m_log.DebugFormat(
- "[SCENE PRESENCE]: Abs pos of {0} is {1}, target {2}, distance {3}",
- Name, AbsolutePosition, m_moveToPositionTarget, distanceToTarget);
+// m_log.DebugFormat(
+// "[SCENE PRESENCE]: Abs pos of {0} is {1}, target {2}, distance {3}",
+// Name, AbsolutePosition, m_moveToPositionTarget, distanceToTarget);
// Check the error term of the current position in relation to the target position
if (distanceToTarget <= 1)
@@ -1637,15 +1641,15 @@ namespace OpenSim.Region.Framework.Scenes
if (LocalVectorToTarget3D.Z > 0) //Up
{
- m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_UP;
+ //m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_UP;
//AgentControlFlags
- AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_UP;
+ //AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_UP;
updated = true;
}
else if (LocalVectorToTarget3D.Z < 0) //Down
{
- m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN;
- AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN;
+ //m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN;
+ //AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_DOWN;
updated = true;
}
@@ -1694,16 +1698,24 @@ namespace OpenSim.Region.Framework.Scenes
///
public void DoMoveToPosition(uint not_used, Vector3 pos, IClientAPI remote_client)
{
- m_log.DebugFormat(
- "[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}",
- Name, pos, m_scene.RegionInfo.RegionName);
+// m_log.DebugFormat(
+// "[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}",
+// Name, pos, m_scene.RegionInfo.RegionName);
+
+ if (pos.X < 0 || pos.X >= Constants.RegionSize
+ || pos.Y < 0 || pos.Y >= Constants.RegionSize
+ || pos.Z < 0)
+ return;
Vector3 heightAdjust = new Vector3(0, 0, Appearance.AvatarHeight / 2);
pos += heightAdjust;
// Anti duck-walking measure
if (Math.Abs(pos.Z - AbsolutePosition.Z) < 0.2f)
+ {
+// m_log.DebugFormat("[SCENE PRESENCE]: Adjusting MoveToPosition from {0} to {1}", pos, AbsolutePosition);
pos.Z = AbsolutePosition.Z;
+ }
m_moveToPositionInProgress = true;
m_moveToPositionTarget = pos;
--
cgit v1.1
From 6e4ec2972266ae250337867fe1ba1944131f212d Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 3 Aug 2011 04:19:19 +0100
Subject: Do a partial fix/implementation of OSSL osNpcMoveTo()
Avatar moves and stops. However, will stop in mid stride.
And if the move to position is in the air, avatar will continue to make vain and quite hilarious attempts to take off (but never doing so).
Clearly more work is needed.
---
OpenSim/Region/Framework/Scenes/EventManager.cs | 11 ++++---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 37 +++++++++++++++---------
2 files changed, 29 insertions(+), 19 deletions(-)
(limited to 'OpenSim/Region/Framework')
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
public delegate void AvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID);
public event AvatarEnteringNewParcel OnAvatarEnteringNewParcel;
- public delegate void SignificantClientMovement(IClientAPI remote_client);
- public event SignificantClientMovement OnSignificantClientMovement;
+ public event Action OnSignificantClientMovement;
public delegate void IncomingInstantMessage(GridInstantMessage message);
public event IncomingInstantMessage OnIncomingInstantMessage;
@@ -1592,16 +1591,16 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- public void TriggerSignificantClientMovement(IClientAPI client)
+ public void TriggerSignificantClientMovement(ScenePresence presence)
{
- SignificantClientMovement handlerSignificantClientMovement = OnSignificantClientMovement;
+ Action handlerSignificantClientMovement = OnSignificantClientMovement;
if (handlerSignificantClientMovement != null)
{
- foreach (SignificantClientMovement d in handlerSignificantClientMovement.GetInvocationList())
+ foreach (Action d in handlerSignificantClientMovement.GetInvocationList())
{
try
{
- d(client);
+ d(presence);
}
catch (Exception e)
{
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index a610b6b..9558258 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -211,7 +211,8 @@ namespace OpenSim.Region.Framework.Scenes
//PauPaw:Proper PID Controler for autopilot************
private bool m_moveToPositionInProgress;
- private Vector3 m_moveToPositionTarget;
+
+ public Vector3 MoveToPositionTarget { get; private set; }
private bool m_followCamAuto;
@@ -1385,7 +1386,7 @@ namespace OpenSim.Region.Framework.Scenes
if (agentData.UseClientAgentPosition)
{
m_moveToPositionInProgress = (agentData.ClientAgentPosition - AbsolutePosition).Length() > 0.2f;
- m_moveToPositionTarget = agentData.ClientAgentPosition;
+ MoveToPositionTarget = agentData.ClientAgentPosition;
}
int i = 0;
@@ -1543,16 +1544,17 @@ namespace OpenSim.Region.Framework.Scenes
/// If true, clear the move to position
/// If true, allow the update in principle.
/// True if movement has been updated in some way. False otherwise.
- protected bool DoMoveToPositionUpdate(
+ public bool DoMoveToPositionUpdate(
ref Vector3 agent_control_v3, Quaternion bodyRotation, bool reset, bool allowUpdate)
{
+// m_log.DebugFormat("[SCENE PRESENCE]: Called DoMoveToPositionUpdate() for {0}", Name);
+
bool updated = false;
//Paupaw:Do Proper PID for Autopilot here
if (reset)
{
- m_moveToPositionTarget = Vector3.Zero;
- m_moveToPositionInProgress = false;
+ ResetMoveToPosition();
updated = true;
}
@@ -1562,16 +1564,16 @@ namespace OpenSim.Region.Framework.Scenes
if (allowUpdate && (m_moveToPositionInProgress && !m_autopilotMoving))
{
- double distanceToTarget = Util.GetDistanceTo(AbsolutePosition, m_moveToPositionTarget);
-// m_log.DebugFormat(
-// "[SCENE PRESENCE]: Abs pos of {0} is {1}, target {2}, distance {3}",
-// Name, AbsolutePosition, m_moveToPositionTarget, distanceToTarget);
+ double distanceToTarget = Util.GetDistanceTo(AbsolutePosition, MoveToPositionTarget);
+ m_log.DebugFormat(
+ "[SCENE PRESENCE]: Abs pos of {0} is {1}, target {2}, distance {3}",
+ Name, AbsolutePosition, MoveToPositionTarget, distanceToTarget);
// Check the error term of the current position in relation to the target position
if (distanceToTarget <= 1)
{
// We are close enough to the target
- m_moveToPositionTarget = Vector3.Zero;
+ MoveToPositionTarget = Vector3.Zero;
m_moveToPositionInProgress = false;
updated = true;
}
@@ -1585,7 +1587,7 @@ namespace OpenSim.Region.Framework.Scenes
// unknown forces are acting on the avatar and we need to adaptively respond
// to such forces, but the following simple approach seems to works fine.
Vector3 LocalVectorToTarget3D =
- (m_moveToPositionTarget - AbsolutePosition) // vector from cur. pos to target in global coords
+ (MoveToPositionTarget - AbsolutePosition) // vector from cur. pos to target in global coords
* Matrix4.CreateFromQuaternion(Quaternion.Inverse(bodyRotation)); // change to avatar coords
// Ignore z component of vector
// Vector3 LocalVectorToTarget2D = new Vector3((float)(LocalVectorToTarget3D.X), (float)(LocalVectorToTarget3D.Y), 0f);
@@ -1718,13 +1720,22 @@ namespace OpenSim.Region.Framework.Scenes
}
m_moveToPositionInProgress = true;
- m_moveToPositionTarget = pos;
+ MoveToPositionTarget = pos;
Vector3 agent_control_v3 = new Vector3();
DoMoveToPositionUpdate(ref agent_control_v3, Rotation, false, true);
AddNewMovement(agent_control_v3, Rotation);
}
+ ///
+ /// Reset the move to position.
+ ///
+ public void ResetMoveToPosition()
+ {
+ MoveToPositionTarget = Vector3.Zero;
+ m_moveToPositionInProgress = false;
+ }
+
private void CheckAtSitTarget()
{
//m_log.Debug("[AUTOPILOT]: " + Util.GetDistanceTo(AbsolutePosition, m_autoPilotTarget).ToString());
@@ -2731,7 +2742,7 @@ namespace OpenSim.Region.Framework.Scenes
if (Util.GetDistanceTo(AbsolutePosition, posLastSignificantMove) > SIGNIFICANT_MOVEMENT)
{
posLastSignificantMove = AbsolutePosition;
- m_scene.EventManager.TriggerSignificantClientMovement(m_controllingClient);
+ m_scene.EventManager.TriggerSignificantClientMovement(this);
}
// Minimum Draw distance is 64 meters, the Radius of the draw distance sphere is 32m
--
cgit v1.1
From 2964467708871f5932c46ad04e002a5506dd7732 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 3 Aug 2011 22:11:05 +0100
Subject: get rid of vestigal move to parameters
---
OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 2 +-
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 7 +++++--
2 files changed, 6 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 1417efb..1370afc 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1650,7 +1650,7 @@ namespace OpenSim.Region.Framework.Scenes
ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar);
if (avatar != null)
{
- avatar.DoMoveToPosition(0, target, null);
+ avatar.DoMoveToPosition(target);
}
}
else
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 9558258..19b7f19 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1537,8 +1537,11 @@ namespace OpenSim.Region.Framework.Scenes
}
///
- /// Process moving the avatar if a position has been set.
+ /// Process move to update for an avatar.
///
+ ///
+ /// This doesn't actually perform the movement. Instead, it adds its vector to agent_control_v3
+ ///
/// Cumulative agent movement that this method will update.
/// New body rotation of the avatar.
/// If true, clear the move to position
@@ -1698,7 +1701,7 @@ namespace OpenSim.Region.Framework.Scenes
/// Move this presence to the given position over time.
///
///
- public void DoMoveToPosition(uint not_used, Vector3 pos, IClientAPI remote_client)
+ public void DoMoveToPosition(Vector3 pos)
{
// m_log.DebugFormat(
// "[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}",
--
cgit v1.1
From a333c60f28acf1298c929f9129d3537f3f97e638 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 3 Aug 2011 22:34:05 +0100
Subject: refactor: rename the move to position methods to move to target to be
consistent with terminology used by scene object part and elsewhere
---
.../Region/Framework/Scenes/SceneObjectGroup.cs | 2 +-
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 46 ++++++----------------
2 files changed, 12 insertions(+), 36 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 1370afc..57baa99 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1650,7 +1650,7 @@ namespace OpenSim.Region.Framework.Scenes
ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar);
if (avatar != null)
{
- avatar.DoMoveToPosition(target);
+ avatar.MoveToTarget(target);
}
}
else
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 19b7f19..f482974 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -780,7 +780,7 @@ namespace OpenSim.Region.Framework.Scenes
m_controllingClient.OnStartAnim += HandleStartAnim;
m_controllingClient.OnStopAnim += HandleStopAnim;
m_controllingClient.OnForceReleaseControls += HandleForceReleaseControls;
- m_controllingClient.OnAutoPilotGo += DoMoveToPosition;
+ m_controllingClient.OnAutoPilotGo += MoveToTarget;
// ControllingClient.OnChildAgentStatus += new StatusChange(this.ChildStatusChange);
// ControllingClient.OnStopMovement += new GenericCall2(this.StopMovement);
@@ -1484,7 +1484,7 @@ namespace OpenSim.Region.Framework.Scenes
i++;
}
- if (DoMoveToPositionUpdate(ref agent_control_v3, bodyRotation, bResetMoveToPosition, bAllowUpdateMoveToPosition))
+ if (HandleMoveToPositionUpdate(ref agent_control_v3, bodyRotation, bResetMoveToPosition, bAllowUpdateMoveToPosition))
update_movementflag = true;
}
@@ -1547,7 +1547,7 @@ namespace OpenSim.Region.Framework.Scenes
/// If true, clear the move to position
/// If true, allow the update in principle.
/// True if movement has been updated in some way. False otherwise.
- public bool DoMoveToPositionUpdate(
+ public bool HandleMoveToPositionUpdate(
ref Vector3 agent_control_v3, Quaternion bodyRotation, bool reset, bool allowUpdate)
{
// m_log.DebugFormat("[SCENE PRESENCE]: Called DoMoveToPositionUpdate() for {0}", Name);
@@ -1557,7 +1557,7 @@ namespace OpenSim.Region.Framework.Scenes
//Paupaw:Do Proper PID for Autopilot here
if (reset)
{
- ResetMoveToPosition();
+ ResetMoveToTarget();
updated = true;
}
@@ -1646,6 +1646,8 @@ namespace OpenSim.Region.Framework.Scenes
if (LocalVectorToTarget3D.Z > 0) //Up
{
+ // Don't set these flags for up or down - doing so will make the avatar crouch or
+ // keep trying to jump even if walking along level ground
//m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_UP;
//AgentControlFlags
//AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_UP;
@@ -1671,37 +1673,11 @@ namespace OpenSim.Region.Framework.Scenes
return updated;
}
-// public void DoAutoPilot(uint not_used, Vector3 Pos, IClientAPI remote_client)
-// {
-// m_autopilotMoving = true;
-// m_autoPilotTarget = Pos;
-// m_sitAtAutoTarget = false;
-// PrimitiveBaseShape proxy = PrimitiveBaseShape.Default;
-// //proxy.PCode = (byte)PCode.ParticleSystem;
-//
-// proxyObjectGroup = new SceneObjectGroup(UUID, Pos, Rotation, proxy);
-// proxyObjectGroup.AttachToScene(m_scene);
-//
-// // Commented out this code since it could never have executed, but might still be informative.
-//// if (proxyObjectGroup != null)
-//// {
-// proxyObjectGroup.SendGroupFullUpdate();
-// remote_client.SendSitResponse(proxyObjectGroup.UUID, Vector3.Zero, Quaternion.Identity, true, Vector3.Zero, Vector3.Zero, false);
-// m_scene.DeleteSceneObject(proxyObjectGroup, false);
-//// }
-//// else
-//// {
-//// m_autopilotMoving = false;
-//// m_autoPilotTarget = Vector3.Zero;
-//// ControllingClient.SendAlertMessage("Autopilot cancelled");
-//// }
-// }
-
///
- /// Move this presence to the given position over time.
+ /// Move to the given target over time.
///
///
- public void DoMoveToPosition(Vector3 pos)
+ public void MoveToTarget(Vector3 pos)
{
// m_log.DebugFormat(
// "[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}",
@@ -1726,14 +1702,14 @@ namespace OpenSim.Region.Framework.Scenes
MoveToPositionTarget = pos;
Vector3 agent_control_v3 = new Vector3();
- DoMoveToPositionUpdate(ref agent_control_v3, Rotation, false, true);
+ HandleMoveToPositionUpdate(ref agent_control_v3, Rotation, false, true);
AddNewMovement(agent_control_v3, Rotation);
}
///
- /// Reset the move to position.
+ /// Reset the move to target.
///
- public void ResetMoveToPosition()
+ public void ResetMoveToTarget()
{
MoveToPositionTarget = Vector3.Zero;
m_moveToPositionInProgress = false;
--
cgit v1.1
From 61d49d4f63eafa68d0b63877029da3475d977263 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 3 Aug 2011 23:20:36 +0100
Subject: rename NPC.Autopilot to NPC.MoveToTarget internally. Add method doc
to INPCModule
---
OpenSim/Region/Framework/Interfaces/INPCModule.cs | 32 ++++++++++++++++++++++-
1 file changed, 31 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs
index 21a755f..fa8d6b6 100644
--- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs
@@ -32,9 +32,39 @@ namespace OpenSim.Region.Framework.Interfaces
{
public interface INPCModule
{
+ ///
+ /// Create an NPC
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// The UUID of the avatar from which to clone the NPC's appearance from.
+ /// The UUID of the ScenePresence created.
UUID CreateNPC(string firstname, string lastname, Vector3 position, Scene scene, UUID cloneAppearanceFrom);
- void Autopilot(UUID agentID, Scene scene, Vector3 pos);
+
+ ///
+ /// Move an NPC to a target over time.
+ ///
+ /// The UUID of the NPC
+ ///
+ ///
+ void MoveToTarget(UUID agentID, Scene scene, Vector3 pos);
+
+ ///
+ /// Get the NPC to say something.
+ ///
+ /// The UUID of the NPC
+ ///
+ ///
void Say(UUID agentID, Scene scene, string text);
+
+
+ ///
+ /// Delete an NPC.
+ ///
+ /// The UUID of the NPC
+ ///
void DeleteNPC(UUID agentID, Scene scene);
}
}
\ No newline at end of file
--
cgit v1.1
From 31fb6b2d72081a7ab27199f57e6a40fc1e478bc2 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 3 Aug 2011 23:40:05 +0100
Subject: remove move to duck walk compensation - no longer required.
extends npc move to regression test to check stop after sufficient sim updates
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index f482974..6a3e79a 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1568,9 +1568,9 @@ namespace OpenSim.Region.Framework.Scenes
if (allowUpdate && (m_moveToPositionInProgress && !m_autopilotMoving))
{
double distanceToTarget = Util.GetDistanceTo(AbsolutePosition, MoveToPositionTarget);
- m_log.DebugFormat(
- "[SCENE PRESENCE]: Abs pos of {0} is {1}, target {2}, distance {3}",
- Name, AbsolutePosition, MoveToPositionTarget, distanceToTarget);
+// m_log.DebugFormat(
+// "[SCENE PRESENCE]: Abs pos of {0} is {1}, target {2}, distance {3}",
+// Name, AbsolutePosition, MoveToPositionTarget, distanceToTarget);
// Check the error term of the current position in relation to the target position
if (distanceToTarget <= 1)
@@ -1688,15 +1688,15 @@ namespace OpenSim.Region.Framework.Scenes
|| pos.Z < 0)
return;
- Vector3 heightAdjust = new Vector3(0, 0, Appearance.AvatarHeight / 2);
- pos += heightAdjust;
-
- // Anti duck-walking measure
- if (Math.Abs(pos.Z - AbsolutePosition.Z) < 0.2f)
- {
-// m_log.DebugFormat("[SCENE PRESENCE]: Adjusting MoveToPosition from {0} to {1}", pos, AbsolutePosition);
- pos.Z = AbsolutePosition.Z;
- }
+// Vector3 heightAdjust = new Vector3(0, 0, Appearance.AvatarHeight / 2);
+// pos += heightAdjust;
+//
+// // Anti duck-walking measure
+// if (Math.Abs(pos.Z - AbsolutePosition.Z) < 0.2f)
+// {
+//// m_log.DebugFormat("[SCENE PRESENCE]: Adjusting MoveToPosition from {0} to {1}", pos, AbsolutePosition);
+// pos.Z = AbsolutePosition.Z;
+// }
m_moveToPositionInProgress = true;
MoveToPositionTarget = pos;
--
cgit v1.1
From 6ab01b338f3888d84bdb710bc7e8cae1899beb8d Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 3 Aug 2011 23:59:13 +0100
Subject: Stop calling the SP.ResetMoveToTarget() code if a target is not
actually set
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 6a3e79a..71dd2eb 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1430,6 +1430,7 @@ namespace OpenSim.Region.Framework.Scenes
// The fact that m_movementflag is a byte needs to be fixed
// it really should be a uint
+ // A DIR_CONTROL_FLAG occurs when the user is trying to move in a particular direction.
uint nudgehack = 250;
foreach (Dir_ControlFlags DCF in DIR_CONTROL_FLAGS)
{
@@ -1554,11 +1555,15 @@ namespace OpenSim.Region.Framework.Scenes
bool updated = false;
- //Paupaw:Do Proper PID for Autopilot here
if (reset)
{
- ResetMoveToTarget();
- updated = true;
+ if (m_moveToPositionInProgress)
+ {
+ ResetMoveToTarget();
+ updated = true;
+ }
+
+ return updated;
}
// m_log.DebugFormat(
@@ -1576,8 +1581,7 @@ namespace OpenSim.Region.Framework.Scenes
if (distanceToTarget <= 1)
{
// We are close enough to the target
- MoveToPositionTarget = Vector3.Zero;
- m_moveToPositionInProgress = false;
+ ResetMoveToTarget();
updated = true;
}
else
@@ -1660,6 +1664,10 @@ namespace OpenSim.Region.Framework.Scenes
updated = true;
}
+// m_log.DebugFormat(
+// "[SCENE PRESENCE]: HandleMoveToTargetUpdate adding {0} to move vector {1} for {2}",
+// LocalVectorToTarget3D, agent_control_v3, Name);
+
agent_control_v3 += LocalVectorToTarget3D;
}
catch (Exception e)
@@ -1711,8 +1719,10 @@ namespace OpenSim.Region.Framework.Scenes
///
public void ResetMoveToTarget()
{
- MoveToPositionTarget = Vector3.Zero;
+// m_log.DebugFormat("[SCENE PRESENCE]: Resetting move to target for {0}", Name);
+
m_moveToPositionInProgress = false;
+ MoveToPositionTarget = Vector3.Zero;
}
private void CheckAtSitTarget()
--
cgit v1.1
From 0299cb060eb55c6b7d068d74d2b9ccc0c607381e Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 4 Aug 2011 00:06:01 +0100
Subject: eliminate a reset position flag by using functionally equivalent
DCFlagKeyPressed
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 71dd2eb..9f7bd9d 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1417,7 +1417,6 @@ namespace OpenSim.Region.Framework.Scenes
if (m_parentID == 0)
{
bool bAllowUpdateMoveToPosition = false;
- bool bResetMoveToPosition = false;
Vector3[] dirVectors;
@@ -1436,8 +1435,8 @@ namespace OpenSim.Region.Framework.Scenes
{
if (((uint)flags & (uint)DCF) != 0)
{
- bResetMoveToPosition = true;
DCFlagKeyPressed = true;
+
try
{
agent_control_v3 += dirVectors[i];
@@ -1485,7 +1484,9 @@ namespace OpenSim.Region.Framework.Scenes
i++;
}
- if (HandleMoveToPositionUpdate(ref agent_control_v3, bodyRotation, bResetMoveToPosition, bAllowUpdateMoveToPosition))
+ // If the user has pressed a key then we want to cancel any move to target.
+ if (HandleMoveToPositionUpdate(
+ ref agent_control_v3, bodyRotation, DCFlagKeyPressed, bAllowUpdateMoveToPosition))
update_movementflag = true;
}
--
cgit v1.1
From a2f5b4ac9afeec2b8f44ba09d7236a134f187bfe Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 4 Aug 2011 00:10:53 +0100
Subject: Rename HandleMoveToPositionUpdate() to HandleMoveToTargetUpdate() for
consistency. Improve method doc.
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 9f7bd9d..4c83def 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1485,7 +1485,7 @@ namespace OpenSim.Region.Framework.Scenes
}
// If the user has pressed a key then we want to cancel any move to target.
- if (HandleMoveToPositionUpdate(
+ if (HandleMoveToTargetUpdate(
ref agent_control_v3, bodyRotation, DCFlagKeyPressed, bAllowUpdateMoveToPosition))
update_movementflag = true;
}
@@ -1539,20 +1539,20 @@ namespace OpenSim.Region.Framework.Scenes
}
///
- /// Process move to update for an avatar.
+ /// Calculate an update to move the presence to the set target.
///
///
- /// This doesn't actually perform the movement. Instead, it adds its vector to agent_control_v3
+ /// This doesn't actually perform the movement. Instead, it adds its vector to agent_control_v3.
///
/// Cumulative agent movement that this method will update.
/// New body rotation of the avatar.
/// If true, clear the move to position
/// If true, allow the update in principle.
/// True if movement has been updated in some way. False otherwise.
- public bool HandleMoveToPositionUpdate(
+ public bool HandleMoveToTargetUpdate(
ref Vector3 agent_control_v3, Quaternion bodyRotation, bool reset, bool allowUpdate)
{
-// m_log.DebugFormat("[SCENE PRESENCE]: Called DoMoveToPositionUpdate() for {0}", Name);
+// m_log.DebugFormat("[SCENE PRESENCE]: Called HandleMoveToTargetUpdate() for {0}", Name);
bool updated = false;
@@ -1711,7 +1711,7 @@ namespace OpenSim.Region.Framework.Scenes
MoveToPositionTarget = pos;
Vector3 agent_control_v3 = new Vector3();
- HandleMoveToPositionUpdate(ref agent_control_v3, Rotation, false, true);
+ HandleMoveToTargetUpdate(ref agent_control_v3, Rotation, false, true);
AddNewMovement(agent_control_v3, Rotation);
}
--
cgit v1.1
From 6f913e8caf8f913a3ad9456905a9a3ea0c48c97c Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 4 Aug 2011 00:13:27 +0100
Subject: eliminate pre-existing unused SP.StopMovement()
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 4c83def..e90e7fd 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1075,14 +1075,7 @@ namespace OpenSim.Region.Framework.Scenes
SendTerseUpdateToAllClients();
}
-
- ///
- ///
- ///
- public void StopMovement()
- {
- }
-
+
public void StopFlying()
{
ControllingClient.StopFlying(this);
--
cgit v1.1
From ba0c65e028ecd3c19a11e6e5557fb004f9dc6c01 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 4 Aug 2011 00:25:51 +0100
Subject: extend npc move test to check a second movement
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index e90e7fd..54ef039 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1075,7 +1075,7 @@ namespace OpenSim.Region.Framework.Scenes
SendTerseUpdateToAllClients();
}
-
+
public void StopFlying()
{
ControllingClient.StopFlying(this);
--
cgit v1.1
From 7f6f100c5a93791e8af29bafcfb93cfd289d5e8b Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 4 Aug 2011 01:00:33 +0100
Subject: When the NPC reaches within the SIGNIFICANT_CLIENT_MOVEMENT distance
of the target, move it directly to the target.
This makes the movement exact. Regression test changed to check avatar reaches exact target.
Also has the nice side effect of making NPC animations continue to work after the first movement (which wasn't working). However, avatar still pauses in mid-stride
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 54ef039..ba10423 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1575,6 +1575,7 @@ namespace OpenSim.Region.Framework.Scenes
if (distanceToTarget <= 1)
{
// We are close enough to the target
+ AbsolutePosition = MoveToPositionTarget;
ResetMoveToTarget();
updated = true;
}
@@ -1713,7 +1714,7 @@ namespace OpenSim.Region.Framework.Scenes
///
public void ResetMoveToTarget()
{
-// m_log.DebugFormat("[SCENE PRESENCE]: Resetting move to target for {0}", Name);
+ m_log.DebugFormat("[SCENE PRESENCE]: Resetting move to target for {0}", Name);
m_moveToPositionInProgress = false;
MoveToPositionTarget = Vector3.Zero;
--
cgit v1.1
From fc64cc2439278f442839c69a7d98125f47019613 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 4 Aug 2011 01:05:43 +0100
Subject: Make SIGNIFICANT_MOVEMENT SP constant a top-level property so that
other classes can use it.
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index ba10423..b7fa3b6 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -89,6 +89,13 @@ namespace OpenSim.Region.Framework.Scenes
///
private static readonly Vector3 SIT_TARGET_ADJUSTMENT = new Vector3(0.1f, 0.0f, 0.3f);
+ ///
+ /// Movement updates for agents in neighboring regions are sent directly to clients.
+ /// This value only affects how often agent positions are sent to neighbor regions
+ /// for things such as distance-based update prioritization
+ ///
+ public static readonly float SIGNIFICANT_MOVEMENT = 2.0f;
+
public UUID currentParcelUUID = UUID.Zero;
private ISceneViewer m_sceneViewer;
@@ -2718,11 +2725,6 @@ namespace OpenSim.Region.Framework.Scenes
///
protected void CheckForSignificantMovement()
{
- // Movement updates for agents in neighboring regions are sent directly to clients.
- // This value only affects how often agent positions are sent to neighbor regions
- // for things such as distance-based update prioritization
- const float SIGNIFICANT_MOVEMENT = 2.0f;
-
if (Util.GetDistanceTo(AbsolutePosition, posLastSignificantMove) > SIGNIFICANT_MOVEMENT)
{
posLastSignificantMove = AbsolutePosition;
--
cgit v1.1
From 7b2b47530e48153b53c00cd33356abbbdb13d0b5 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 4 Aug 2011 01:16:24 +0100
Subject: move reset code out of HandleMoveToTargetUpdate() so that we only
call it where needed instead of passing in a flag
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 28 ++++++++++--------------
1 file changed, 12 insertions(+), 16 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index b7fa3b6..d471414 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1485,9 +1485,17 @@ namespace OpenSim.Region.Framework.Scenes
}
// If the user has pressed a key then we want to cancel any move to target.
- if (HandleMoveToTargetUpdate(
- ref agent_control_v3, bodyRotation, DCFlagKeyPressed, bAllowUpdateMoveToPosition))
+ if (DCFlagKeyPressed && m_moveToPositionInProgress)
+ {
+ ResetMoveToTarget();
update_movementflag = true;
+ }
+ else
+ {
+ if (HandleMoveToTargetUpdate(
+ ref agent_control_v3, bodyRotation, bAllowUpdateMoveToPosition))
+ update_movementflag = true;
+ }
}
// Cause the avatar to stop flying if it's colliding
@@ -1546,27 +1554,15 @@ namespace OpenSim.Region.Framework.Scenes
///
/// Cumulative agent movement that this method will update.
/// New body rotation of the avatar.
- /// If true, clear the move to position
/// If true, allow the update in principle.
/// True if movement has been updated in some way. False otherwise.
public bool HandleMoveToTargetUpdate(
- ref Vector3 agent_control_v3, Quaternion bodyRotation, bool reset, bool allowUpdate)
+ ref Vector3 agent_control_v3, Quaternion bodyRotation, bool allowUpdate)
{
// m_log.DebugFormat("[SCENE PRESENCE]: Called HandleMoveToTargetUpdate() for {0}", Name);
bool updated = false;
- if (reset)
- {
- if (m_moveToPositionInProgress)
- {
- ResetMoveToTarget();
- updated = true;
- }
-
- return updated;
- }
-
// m_log.DebugFormat(
// "[SCENE PRESENCE]: bAllowUpdateMoveToPosition {0}, m_moveToPositionInProgress {1}, m_autopilotMoving {2}",
// allowUpdate, m_moveToPositionInProgress, m_autopilotMoving);
@@ -1712,7 +1708,7 @@ namespace OpenSim.Region.Framework.Scenes
MoveToPositionTarget = pos;
Vector3 agent_control_v3 = new Vector3();
- HandleMoveToTargetUpdate(ref agent_control_v3, Rotation, false, true);
+ HandleMoveToTargetUpdate(ref agent_control_v3, Rotation, true);
AddNewMovement(agent_control_v3, Rotation);
}
--
cgit v1.1
From 831f933ce63eb8cf2bb24c1258ae5aeff394740f Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 4 Aug 2011 01:22:01 +0100
Subject: only call move target code in SP.HandleAgentUpdate() if we're
actually in the process of moving to a position
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index d471414..bb15a45 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1484,17 +1484,20 @@ namespace OpenSim.Region.Framework.Scenes
i++;
}
- // If the user has pressed a key then we want to cancel any move to target.
- if (DCFlagKeyPressed && m_moveToPositionInProgress)
+ if (m_moveToPositionInProgress)
{
- ResetMoveToTarget();
- update_movementflag = true;
- }
- else
- {
- if (HandleMoveToTargetUpdate(
- ref agent_control_v3, bodyRotation, bAllowUpdateMoveToPosition))
+ // If the user has pressed a key then we want to cancel any move to target.
+ if (DCFlagKeyPressed)
+ {
+ ResetMoveToTarget();
update_movementflag = true;
+ }
+ else
+ {
+ if (HandleMoveToTargetUpdate(
+ ref agent_control_v3, bodyRotation, bAllowUpdateMoveToPosition))
+ update_movementflag = true;
+ }
}
}
--
cgit v1.1
From 61a931490dae6a10adc915788bc661680be6778c Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 4 Aug 2011 01:30:37 +0100
Subject: move bAllowUpdateMoveToPosition switch outside of
HandleMoveToTargetUpdate()
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index bb15a45..620db94 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1492,10 +1492,9 @@ namespace OpenSim.Region.Framework.Scenes
ResetMoveToTarget();
update_movementflag = true;
}
- else
+ else if (bAllowUpdateMoveToPosition)
{
- if (HandleMoveToTargetUpdate(
- ref agent_control_v3, bodyRotation, bAllowUpdateMoveToPosition))
+ if (HandleMoveToTargetUpdate(ref agent_control_v3, bodyRotation))
update_movementflag = true;
}
}
@@ -1557,10 +1556,8 @@ namespace OpenSim.Region.Framework.Scenes
///
/// Cumulative agent movement that this method will update.
/// New body rotation of the avatar.
- /// If true, allow the update in principle.
/// True if movement has been updated in some way. False otherwise.
- public bool HandleMoveToTargetUpdate(
- ref Vector3 agent_control_v3, Quaternion bodyRotation, bool allowUpdate)
+ public bool HandleMoveToTargetUpdate(ref Vector3 agent_control_v3, Quaternion bodyRotation)
{
// m_log.DebugFormat("[SCENE PRESENCE]: Called HandleMoveToTargetUpdate() for {0}", Name);
@@ -1570,7 +1567,7 @@ namespace OpenSim.Region.Framework.Scenes
// "[SCENE PRESENCE]: bAllowUpdateMoveToPosition {0}, m_moveToPositionInProgress {1}, m_autopilotMoving {2}",
// allowUpdate, m_moveToPositionInProgress, m_autopilotMoving);
- if (allowUpdate && (m_moveToPositionInProgress && !m_autopilotMoving))
+ if (!m_autopilotMoving)
{
double distanceToTarget = Util.GetDistanceTo(AbsolutePosition, MoveToPositionTarget);
// m_log.DebugFormat(
@@ -1711,7 +1708,7 @@ namespace OpenSim.Region.Framework.Scenes
MoveToPositionTarget = pos;
Vector3 agent_control_v3 = new Vector3();
- HandleMoveToTargetUpdate(ref agent_control_v3, Rotation, true);
+ HandleMoveToTargetUpdate(ref agent_control_v3, Rotation);
AddNewMovement(agent_control_v3, Rotation);
}
--
cgit v1.1
From c678b75d65f796f48ae0aacab7325c3aedb0d999 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 4 Aug 2011 01:45:56 +0100
Subject: if a move to target is set underground, constrain it to the terrain
height
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 620db94..98e90b9 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1635,7 +1635,6 @@ namespace OpenSim.Region.Framework.Scenes
if (LocalVectorToTarget3D.Y > 0) //MoveLeft
{
m_movementflag += (byte)(uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT;
- //AgentControlFlags
AgentControlFlags |= (uint)Dir_ControlFlags.DIR_CONTROL_FLAG_LEFT;
updated = true;
}
@@ -1704,6 +1703,9 @@ namespace OpenSim.Region.Framework.Scenes
// pos.Z = AbsolutePosition.Z;
// }
+ float terrainHeight = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y];
+ pos.Z = Math.Max(terrainHeight, pos.Z);
+
m_moveToPositionInProgress = true;
MoveToPositionTarget = pos;
--
cgit v1.1
From 54ce0293423b4286fe62cbadc3b1441cae5f78eb Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 4 Aug 2011 02:31:40 +0100
Subject: if an NPC move to target is above the terrain then make it fly to
destination
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 26 +++++++++++++++++-------
1 file changed, 19 insertions(+), 7 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 98e90b9..17b55bf 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -217,8 +217,7 @@ namespace OpenSim.Region.Framework.Scenes
private string m_nextSitAnimation = String.Empty;
//PauPaw:Proper PID Controler for autopilot************
- private bool m_moveToPositionInProgress;
-
+ public bool MovingToTarget { get; private set; }
public Vector3 MoveToPositionTarget { get; private set; }
private bool m_followCamAuto;
@@ -1385,7 +1384,7 @@ namespace OpenSim.Region.Framework.Scenes
if (agentData.UseClientAgentPosition)
{
- m_moveToPositionInProgress = (agentData.ClientAgentPosition - AbsolutePosition).Length() > 0.2f;
+ MovingToTarget = (agentData.ClientAgentPosition - AbsolutePosition).Length() > 0.2f;
MoveToPositionTarget = agentData.ClientAgentPosition;
}
@@ -1484,7 +1483,7 @@ namespace OpenSim.Region.Framework.Scenes
i++;
}
- if (m_moveToPositionInProgress)
+ if (MovingToTarget)
{
// If the user has pressed a key then we want to cancel any move to target.
if (DCFlagKeyPressed)
@@ -1539,7 +1538,7 @@ namespace OpenSim.Region.Framework.Scenes
&& ((flags & AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) == 0)
&& (m_parentID == 0)
&& !SitGround
- && !m_moveToPositionInProgress)
+ && !MovingToTarget)
Animator.UpdateMovementAnimations();
}
@@ -1706,7 +1705,20 @@ namespace OpenSim.Region.Framework.Scenes
float terrainHeight = (float)m_scene.Heightmap[(int)pos.X, (int)pos.Y];
pos.Z = Math.Max(terrainHeight, pos.Z);
- m_moveToPositionInProgress = true;
+ // Fudge factor. It appears that if one clicks "go here" on a piece of ground, the go here request is
+ // always slightly higher than the actual terrain height.
+ // FIXME: This constrains NOC movements as well, so should be somewhere else.
+ if (pos.Z - terrainHeight < 0.2)
+ pos.Z = terrainHeight;
+
+// m_log.DebugFormat(
+// "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}",
+// Name, pos, terrainHeight, m_scene.RegionInfo.RegionName);
+
+ if (pos.Z > terrainHeight)
+ PhysicsActor.Flying = true;
+
+ MovingToTarget = true;
MoveToPositionTarget = pos;
Vector3 agent_control_v3 = new Vector3();
@@ -1721,7 +1733,7 @@ namespace OpenSim.Region.Framework.Scenes
{
m_log.DebugFormat("[SCENE PRESENCE]: Resetting move to target for {0}", Name);
- m_moveToPositionInProgress = false;
+ MovingToTarget = false;
MoveToPositionTarget = Vector3.Zero;
}
--
cgit v1.1
From 1918402cb181a39f8c085a409909dccb5c988aa1 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 4 Aug 2011 03:08:35 +0100
Subject: if an NPC target is set to a ground location, then automatically land
them when they get there.
This doesn't help where the target is a prim surface. In these situations, it might be better to provide manual overrides so the script can control whethre an avatar flys there/lands, etc.
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 17b55bf..d40132e 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1537,8 +1537,7 @@ namespace OpenSim.Region.Framework.Scenes
if (update_movementflag
&& ((flags & AgentManager.ControlFlags.AGENT_CONTROL_SIT_ON_GROUND) == 0)
&& (m_parentID == 0)
- && !SitGround
- && !MovingToTarget)
+ && !SitGround)
Animator.UpdateMovementAnimations();
}
@@ -1711,9 +1710,9 @@ namespace OpenSim.Region.Framework.Scenes
if (pos.Z - terrainHeight < 0.2)
pos.Z = terrainHeight;
-// m_log.DebugFormat(
-// "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}",
-// Name, pos, terrainHeight, m_scene.RegionInfo.RegionName);
+ m_log.DebugFormat(
+ "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}",
+ Name, pos, terrainHeight, m_scene.RegionInfo.RegionName);
if (pos.Z > terrainHeight)
PhysicsActor.Flying = true;
--
cgit v1.1
From 94d496cf2b7704adbef2cac5c8341a48b73f5fd5 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 5 Aug 2011 00:57:43 +0100
Subject: remove the largely unused copy/pasted HandleAgentRequestSit() method
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 51 +++++-------------------
1 file changed, 11 insertions(+), 40 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index d40132e..d354c0a 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1890,7 +1890,7 @@ namespace OpenSim.Region.Framework.Scenes
bool forceMouselook = false;
//SceneObjectPart part = m_scene.GetSceneObjectPart(targetID);
- SceneObjectPart part = FindNextAvailableSitTarget(targetID);
+ SceneObjectPart part = FindNextAvailableSitTarget(targetID);
if (part != null)
{
// TODO: determine position to sit at based on scene geometry; don't trust offset from client
@@ -1966,14 +1966,23 @@ namespace OpenSim.Region.Framework.Scenes
HandleAgentSit(remoteClient, UUID);
}
+ // public void HandleAgentRequestSit(IClientAPI remoteClient, UUID agentID, UUID targetID, Vector3 offset, string sitAnimation)
public void HandleAgentRequestSit(IClientAPI remoteClient, UUID agentID, UUID targetID, Vector3 offset)
{
if (m_parentID != 0)
{
StandUp();
}
+
+// if (!String.IsNullOrEmpty(sitAnimation))
+// {
+// m_nextSitAnimation = sitAnimation;
+// }
+// else
+// {
m_nextSitAnimation = "SIT";
-
+// }
+
//SceneObjectPart part = m_scene.GetSceneObjectPart(targetID);
SceneObjectPart part = FindNextAvailableSitTarget(targetID);
@@ -1998,7 +2007,6 @@ namespace OpenSim.Region.Framework.Scenes
}
else
{
-
m_log.Warn("Sit requested on unknown object: " + targetID.ToString());
}
@@ -2196,44 +2204,7 @@ namespace OpenSim.Region.Framework.Scenes
SendSitResponse(ControllingClient, m_requestedSitTargetUUID, collisionPoint - m_requestedSitOffset, Quaternion.Identity);
}
*/
- public void HandleAgentRequestSit(IClientAPI remoteClient, UUID agentID, UUID targetID, Vector3 offset, string sitAnimation)
- {
- if (m_parentID != 0)
- {
- StandUp();
- }
- if (!String.IsNullOrEmpty(sitAnimation))
- {
- m_nextSitAnimation = sitAnimation;
- }
- else
- {
- m_nextSitAnimation = "SIT";
- }
- //SceneObjectPart part = m_scene.GetSceneObjectPart(targetID);
- SceneObjectPart part = FindNextAvailableSitTarget(targetID);
- if (part != null)
- {
- m_requestedSitTargetID = part.LocalId;
- //m_requestedSitOffset = offset;
- m_requestedSitTargetUUID = targetID;
-
- m_log.DebugFormat("[SIT]: Client requested Sit Position: {0}", offset);
-
- if (m_scene.PhysicsScene.SupportsRayCast())
- {
- //SitRayCastAvatarPosition(part);
- //return;
- }
- }
- else
- {
- m_log.Warn("Sit requested on unknown object: " + targetID);
- }
-
- SendSitResponse(remoteClient, targetID, offset, Quaternion.Identity);
- }
public void HandleAgentSit(IClientAPI remoteClient, UUID agentID)
{
--
cgit v1.1