aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-08-11 03:05:51 +0100
committerJustin Clark-Casey (justincc)2011-08-11 03:06:38 +0100
commit1aa171189397f34d7d18fb358f7bd767d241675a (patch)
tree474334e8cd0c01f4d39a7aab1aaae5bef55316ea /OpenSim/Region
parentinstead of setting avatar rotation twice in SP.HandleAgentUpdate(), eliminate... (diff)
downloadopensim-SC_OLD-1aa171189397f34d7d18fb358f7bd767d241675a.zip
opensim-SC_OLD-1aa171189397f34d7d18fb358f7bd767d241675a.tar.gz
opensim-SC_OLD-1aa171189397f34d7d18fb358f7bd767d241675a.tar.bz2
opensim-SC_OLD-1aa171189397f34d7d18fb358f7bd767d241675a.tar.xz
eliminate the rotation parameter from SP.HandleMoveToTargetUpdate(). This can just use the currently set Rotation
looks like I spoke to soon about eliminating jerkiness on "go here"/autopilot. It's still there.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs9
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs7
2 files changed, 10 insertions, 6 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index a1bd672..afa896c 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1496,7 +1496,7 @@ namespace OpenSim.Region.Framework.Scenes
1496 } 1496 }
1497 else if (bAllowUpdateMoveToPosition) 1497 else if (bAllowUpdateMoveToPosition)
1498 { 1498 {
1499 if (HandleMoveToTargetUpdate(ref agent_control_v3, bodyRotation)) 1499 if (HandleMoveToTargetUpdate(ref agent_control_v3))
1500 update_movementflag = true; 1500 update_movementflag = true;
1501 } 1501 }
1502 } 1502 }
@@ -1556,9 +1556,8 @@ namespace OpenSim.Region.Framework.Scenes
1556 /// This doesn't actually perform the movement. Instead, it adds its vector to agent_control_v3. 1556 /// This doesn't actually perform the movement. Instead, it adds its vector to agent_control_v3.
1557 /// </remarks> 1557 /// </remarks>
1558 /// <param value="agent_control_v3">Cumulative agent movement that this method will update.</param> 1558 /// <param value="agent_control_v3">Cumulative agent movement that this method will update.</param>
1559 /// <param value="bodyRotation">New body rotation of the avatar.</param>
1560 /// <returns>True if movement has been updated in some way. False otherwise.</returns> 1559 /// <returns>True if movement has been updated in some way. False otherwise.</returns>
1561 public bool HandleMoveToTargetUpdate(ref Vector3 agent_control_v3, Quaternion bodyRotation) 1560 public bool HandleMoveToTargetUpdate(ref Vector3 agent_control_v3)
1562 { 1561 {
1563// m_log.DebugFormat("[SCENE PRESENCE]: Called HandleMoveToTargetUpdate() for {0}", Name); 1562// m_log.DebugFormat("[SCENE PRESENCE]: Called HandleMoveToTargetUpdate() for {0}", Name);
1564 1563
@@ -1594,7 +1593,7 @@ namespace OpenSim.Region.Framework.Scenes
1594 // to such forces, but the following simple approach seems to works fine. 1593 // to such forces, but the following simple approach seems to works fine.
1595 Vector3 LocalVectorToTarget3D = 1594 Vector3 LocalVectorToTarget3D =
1596 (MoveToPositionTarget - AbsolutePosition) // vector from cur. pos to target in global coords 1595 (MoveToPositionTarget - AbsolutePosition) // vector from cur. pos to target in global coords
1597 * Matrix4.CreateFromQuaternion(Quaternion.Inverse(bodyRotation)); // change to avatar coords 1596 * Matrix4.CreateFromQuaternion(Quaternion.Inverse(Rotation)); // change to avatar coords
1598 // Ignore z component of vector 1597 // Ignore z component of vector
1599// Vector3 LocalVectorToTarget2D = new Vector3((float)(LocalVectorToTarget3D.X), (float)(LocalVectorToTarget3D.Y), 0f); 1598// Vector3 LocalVectorToTarget2D = new Vector3((float)(LocalVectorToTarget3D.X), (float)(LocalVectorToTarget3D.Y), 0f);
1600 LocalVectorToTarget3D.Normalize(); 1599 LocalVectorToTarget3D.Normalize();
@@ -1731,7 +1730,7 @@ namespace OpenSim.Region.Framework.Scenes
1731 MoveToPositionTarget = pos; 1730 MoveToPositionTarget = pos;
1732 1731
1733 Vector3 agent_control_v3 = new Vector3(); 1732 Vector3 agent_control_v3 = new Vector3();
1734 HandleMoveToTargetUpdate(ref agent_control_v3, Rotation); 1733 HandleMoveToTargetUpdate(ref agent_control_v3);
1735 AddNewMovement(agent_control_v3); 1734 AddNewMovement(agent_control_v3);
1736 } 1735 }
1737 1736
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index 9b86abb..580d7ef 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -81,6 +81,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC
81 81
82 if (presence.PhysicsActor.Flying) 82 if (presence.PhysicsActor.Flying)
83 { 83 {
84 // A horrible hack to stop the NPC dead in its tracks rather than having them overshoot
85 // the target if flying.
86 // We really need to be more subtle (slow the avatar as it approaches the target) or at
87 // least be able to set collision status once, rather than 5 times to give it enough
88 // weighting so that that PhysicsActor thinks it really is colliding.
84 for (int i = 0; i < 5; i++) 89 for (int i = 0; i < 5; i++)
85 presence.PhysicsActor.IsColliding = true; 90 presence.PhysicsActor.IsColliding = true;
86 91
@@ -106,7 +111,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
106 presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget); 111 presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget);
107 112
108 Vector3 agent_control_v3 = new Vector3(); 113 Vector3 agent_control_v3 = new Vector3();
109 presence.HandleMoveToTargetUpdate(ref agent_control_v3, presence.Rotation); 114 presence.HandleMoveToTargetUpdate(ref agent_control_v3);
110 presence.AddNewMovement(agent_control_v3); 115 presence.AddNewMovement(agent_control_v3);
111 } 116 }
112// 117//