aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-08-11 02:54:15 +0100
committerJustin Clark-Casey (justincc)2011-08-11 02:54:15 +0100
commit36f7d36fa1556d2b9356bc9bc5d9b16fc81eb96a (patch)
tree336b15fd53cda17f8026317fa77e10a6d2eaf80b
parentget rid of intermediate local store of body rotation in ScenePresence, this i... (diff)
downloadopensim-SC-36f7d36fa1556d2b9356bc9bc5d9b16fc81eb96a.zip
opensim-SC-36f7d36fa1556d2b9356bc9bc5d9b16fc81eb96a.tar.gz
opensim-SC-36f7d36fa1556d2b9356bc9bc5d9b16fc81eb96a.tar.bz2
opensim-SC-36f7d36fa1556d2b9356bc9bc5d9b16fc81eb96a.tar.xz
instead of setting avatar rotation twice in SP.HandleAgentUpdate(), eliminate the second setting in AddNewMovement()
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs30
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs2
2 files changed, 15 insertions, 17 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index e28d1fe..a1bd672 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1298,7 +1298,6 @@ namespace OpenSim.Region.Framework.Scenes
1298 #region Inputs 1298 #region Inputs
1299 1299
1300 AgentManager.ControlFlags flags = (AgentManager.ControlFlags)agentData.ControlFlags; 1300 AgentManager.ControlFlags flags = (AgentManager.ControlFlags)agentData.ControlFlags;
1301 Quaternion bodyRotation = agentData.BodyRotation;
1302 1301
1303 // Camera location in world. We'll need to raytrace 1302 // Camera location in world. We'll need to raytrace
1304 // from this location from time to time. 1303 // from this location from time to time.
@@ -1384,6 +1383,15 @@ namespace OpenSim.Region.Framework.Scenes
1384 1383
1385 if (m_allowMovement && !SitGround) 1384 if (m_allowMovement && !SitGround)
1386 { 1385 {
1386 Quaternion bodyRotation = agentData.BodyRotation;
1387 bool update_rotation = false;
1388
1389 if (bodyRotation != m_bodyRot)
1390 {
1391 Rotation = bodyRotation;
1392 update_rotation = true;
1393 }
1394
1387 bool update_movementflag = false; 1395 bool update_movementflag = false;
1388 1396
1389 if (agentData.UseClientAgentPosition) 1397 if (agentData.UseClientAgentPosition)
@@ -1393,8 +1401,6 @@ namespace OpenSim.Region.Framework.Scenes
1393 } 1401 }
1394 1402
1395 int i = 0; 1403 int i = 0;
1396
1397 bool update_rotation = false;
1398 bool DCFlagKeyPressed = false; 1404 bool DCFlagKeyPressed = false;
1399 Vector3 agent_control_v3 = Vector3.Zero; 1405 Vector3 agent_control_v3 = Vector3.Zero;
1400 1406
@@ -1410,12 +1416,6 @@ namespace OpenSim.Region.Framework.Scenes
1410 if (actor.Flying != oldflying) 1416 if (actor.Flying != oldflying)
1411 update_movementflag = true; 1417 update_movementflag = true;
1412 1418
1413 if (bodyRotation != m_bodyRot)
1414 {
1415 m_bodyRot = bodyRotation;
1416 update_rotation = true;
1417 }
1418
1419 if (m_parentID == 0) 1419 if (m_parentID == 0)
1420 { 1420 {
1421 bool bAllowUpdateMoveToPosition = false; 1421 bool bAllowUpdateMoveToPosition = false;
@@ -1467,8 +1467,8 @@ namespace OpenSim.Region.Framework.Scenes
1467 ) // This or is for Nudge forward 1467 ) // This or is for Nudge forward
1468 { 1468 {
1469 m_movementflag -= ((byte)(uint)DCF); 1469 m_movementflag -= ((byte)(uint)DCF);
1470
1471 update_movementflag = true; 1470 update_movementflag = true;
1471
1472 /* 1472 /*
1473 if ((DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACKWARD_NUDGE) 1473 if ((DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACKWARD_NUDGE)
1474 && ((m_movementflag & (byte)nudgehack) == nudgehack)) 1474 && ((m_movementflag & (byte)nudgehack) == nudgehack))
@@ -1534,7 +1534,7 @@ namespace OpenSim.Region.Framework.Scenes
1534 // m_log.DebugFormat( 1534 // m_log.DebugFormat(
1535 // "In {0} adding velocity to {1} of {2}", m_scene.RegionInfo.RegionName, Name, agent_control_v3); 1535 // "In {0} adding velocity to {1} of {2}", m_scene.RegionInfo.RegionName, Name, agent_control_v3);
1536 1536
1537 AddNewMovement(agent_control_v3, bodyRotation); 1537 AddNewMovement(agent_control_v3);
1538 } 1538 }
1539 1539
1540 if (update_movementflag 1540 if (update_movementflag
@@ -1732,7 +1732,7 @@ namespace OpenSim.Region.Framework.Scenes
1732 1732
1733 Vector3 agent_control_v3 = new Vector3(); 1733 Vector3 agent_control_v3 = new Vector3();
1734 HandleMoveToTargetUpdate(ref agent_control_v3, Rotation); 1734 HandleMoveToTargetUpdate(ref agent_control_v3, Rotation);
1735 AddNewMovement(agent_control_v3, Rotation); 1735 AddNewMovement(agent_control_v3);
1736 } 1736 }
1737 1737
1738 /// <summary> 1738 /// <summary>
@@ -2311,13 +2311,11 @@ namespace OpenSim.Region.Framework.Scenes
2311 /// Rotate the avatar to the given rotation and apply a movement in the given relative vector 2311 /// Rotate the avatar to the given rotation and apply a movement in the given relative vector
2312 /// </summary> 2312 /// </summary>
2313 /// <param name="vec">The vector in which to move. This is relative to the rotation argument</param> 2313 /// <param name="vec">The vector in which to move. This is relative to the rotation argument</param>
2314 /// <param name="rotation">The direction in which this avatar should now face. 2314 public void AddNewMovement(Vector3 vec)
2315 public void AddNewMovement(Vector3 vec, Quaternion rotation)
2316 { 2315 {
2317 m_perfMonMS = Util.EnvironmentTickCount(); 2316 m_perfMonMS = Util.EnvironmentTickCount();
2318 2317
2319 Rotation = rotation; 2318 Vector3 direc = vec * Rotation;
2320 Vector3 direc = vec * rotation;
2321 direc.Normalize(); 2319 direc.Normalize();
2322 2320
2323 direc *= 0.03f * 128f * m_speedModifier; 2321 direc *= 0.03f * 128f * m_speedModifier;
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index 0e313df..9b86abb 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -107,7 +107,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
107 107
108 Vector3 agent_control_v3 = new Vector3(); 108 Vector3 agent_control_v3 = new Vector3();
109 presence.HandleMoveToTargetUpdate(ref agent_control_v3, presence.Rotation); 109 presence.HandleMoveToTargetUpdate(ref agent_control_v3, presence.Rotation);
110 presence.AddNewMovement(agent_control_v3, presence.Rotation); 110 presence.AddNewMovement(agent_control_v3);
111 } 111 }
112// 112//
113//// presence.DoMoveToPositionUpdate((0, presence.MoveToPositionTarget, null); 113//// presence.DoMoveToPositionUpdate((0, presence.MoveToPositionTarget, null);