diff options
Diffstat (limited to 'OpenSim/Region/Framework')
5 files changed, 130 insertions, 35 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index 2e4c260..30a95ce 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs | |||
@@ -156,8 +156,8 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
156 | Vector3 left = Vector3.Transform(Vector3.UnitY, rotMatrix); | 156 | Vector3 left = Vector3.Transform(Vector3.UnitY, rotMatrix); |
157 | 157 | ||
158 | // Check control flags | 158 | // Check control flags |
159 | bool heldForward = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_AT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_AT_POS; | 159 | bool heldForward = ((controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_AT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_AT_POS || (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS); |
160 | bool heldBack = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG; | 160 | bool heldBack = ((controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_AT_NEG || (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG); |
161 | bool heldLeft = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS; | 161 | bool heldLeft = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS) == AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS; |
162 | bool heldRight = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG; | 162 | bool heldRight = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG) == AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG; |
163 | //bool heldTurnLeft = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT) == AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT; | 163 | //bool heldTurnLeft = (controlFlags & AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT) == AgentManager.ControlFlags.AGENT_CONTROL_TURN_LEFT; |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index f444e51..4ffa1a2 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1164,16 +1164,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
1164 | // Check if any objects have reached their targets | 1164 | // Check if any objects have reached their targets |
1165 | CheckAtTargets(); | 1165 | CheckAtTargets(); |
1166 | 1166 | ||
1167 | // Update SceneObjectGroups that have scheduled themselves for updates | ||
1168 | // Objects queue their updates onto all scene presences | ||
1169 | if (m_frame % m_update_objects == 0) | ||
1170 | m_sceneGraph.UpdateObjectGroups(); | ||
1171 | |||
1172 | // Run through all ScenePresences looking for updates | 1167 | // Run through all ScenePresences looking for updates |
1173 | // Presence updates and queued object updates for each presence are sent to clients | 1168 | // Presence updates and queued object updates for each presence are sent to clients |
1174 | if (m_frame % m_update_presences == 0) | 1169 | if (m_frame % m_update_presences == 0) |
1175 | m_sceneGraph.UpdatePresences(); | 1170 | m_sceneGraph.UpdatePresences(); |
1176 | 1171 | ||
1172 | // Update SceneObjectGroups that have scheduled themselves for updates | ||
1173 | // Objects queue their updates onto all scene presences | ||
1174 | if (m_frame % m_update_objects == 0) | ||
1175 | m_sceneGraph.UpdateObjectGroups(); | ||
1176 | |||
1177 | int TempPhysicsMS2 = Environment.TickCount; | 1177 | int TempPhysicsMS2 = Environment.TickCount; |
1178 | if ((m_frame % m_update_physics == 0) && m_physics_enabled) | 1178 | if ((m_frame % m_update_physics == 0) && m_physics_enabled) |
1179 | m_sceneGraph.UpdatePreparePhysics(); | 1179 | m_sceneGraph.UpdatePreparePhysics(); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index bcc9b37..ea4f2c7 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -1734,6 +1734,45 @@ namespace OpenSim.Region.Framework.Scenes | |||
1734 | } | 1734 | } |
1735 | } | 1735 | } |
1736 | 1736 | ||
1737 | public void rotLookAt(Quaternion target, float strength, float damping) | ||
1738 | { | ||
1739 | SceneObjectPart rootpart = m_rootPart; | ||
1740 | if (rootpart != null) | ||
1741 | { | ||
1742 | if (IsAttachment) | ||
1743 | { | ||
1744 | /* | ||
1745 | ScenePresence avatar = m_scene.GetScenePresence(rootpart.AttachedAvatar); | ||
1746 | if (avatar != null) | ||
1747 | { | ||
1748 | Rotate the Av? | ||
1749 | } */ | ||
1750 | } | ||
1751 | else | ||
1752 | { | ||
1753 | if (rootpart.PhysActor != null) | ||
1754 | { | ||
1755 | rootpart.PhysActor.APIDTarget = new Quaternion(target.X, target.Y, target.Z, target.W); | ||
1756 | rootpart.PhysActor.APIDStrength = strength; | ||
1757 | rootpart.PhysActor.APIDDamping = damping; | ||
1758 | rootpart.PhysActor.APIDActive = true; | ||
1759 | } | ||
1760 | } | ||
1761 | } | ||
1762 | } | ||
1763 | public void stopLookAt() | ||
1764 | { | ||
1765 | SceneObjectPart rootpart = m_rootPart; | ||
1766 | if (rootpart != null) | ||
1767 | { | ||
1768 | if (rootpart.PhysActor != null) | ||
1769 | { | ||
1770 | rootpart.PhysActor.APIDActive = false; | ||
1771 | } | ||
1772 | } | ||
1773 | |||
1774 | } | ||
1775 | |||
1737 | /// <summary> | 1776 | /// <summary> |
1738 | /// Uses a PID to attempt to clamp the object on the Z axis at the given height over tau seconds. | 1777 | /// Uses a PID to attempt to clamp the object on the Z axis at the given height over tau seconds. |
1739 | /// </summary> | 1778 | /// </summary> |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 6f1b458..cdec135 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -1064,14 +1064,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1064 | } | 1064 | } |
1065 | } | 1065 | } |
1066 | 1066 | ||
1067 | /// <summary> | ||
1068 | /// Clear all pending updates of parts to clients | ||
1069 | /// </summary> | ||
1070 | private void ClearUpdateSchedule() | ||
1071 | { | ||
1072 | m_updateFlag = 0; | ||
1073 | } | ||
1074 | |||
1075 | private void SendObjectPropertiesToClient(UUID AgentID) | 1067 | private void SendObjectPropertiesToClient(UUID AgentID) |
1076 | { | 1068 | { |
1077 | ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); | 1069 | ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); |
@@ -2185,6 +2177,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2185 | ParentGroup.HasGroupChanged = true; | 2177 | ParentGroup.HasGroupChanged = true; |
2186 | ScheduleFullUpdate(); | 2178 | ScheduleFullUpdate(); |
2187 | } | 2179 | } |
2180 | |||
2181 | public void RotLookAt(Quaternion target, float strength, float damping) | ||
2182 | { | ||
2183 | m_parentGroup.rotLookAt(target, strength, damping); | ||
2184 | } | ||
2188 | 2185 | ||
2189 | /// <summary> | 2186 | /// <summary> |
2190 | /// Schedules this prim for a full update | 2187 | /// Schedules this prim for a full update |
@@ -2389,8 +2386,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2389 | { | 2386 | { |
2390 | const float ROTATION_TOLERANCE = 0.01f; | 2387 | const float ROTATION_TOLERANCE = 0.01f; |
2391 | const float VELOCITY_TOLERANCE = 0.001f; | 2388 | const float VELOCITY_TOLERANCE = 0.001f; |
2392 | const float POSITION_TOLERANCE = 0.05f; | 2389 | const float POSITION_TOLERANCE = 0.05f; // I don't like this, but I suppose it's necessary |
2393 | const int TIME_MS_TOLERANCE = 3000; | 2390 | const int TIME_MS_TOLERANCE = 200; //llSetPos has a 200ms delay. This should NOT be 3 seconds. |
2394 | 2391 | ||
2395 | if (m_updateFlag == 1) | 2392 | if (m_updateFlag == 1) |
2396 | { | 2393 | { |
@@ -2404,7 +2401,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2404 | Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) | 2401 | Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) |
2405 | { | 2402 | { |
2406 | AddTerseUpdateToAllAvatars(); | 2403 | AddTerseUpdateToAllAvatars(); |
2407 | ClearUpdateSchedule(); | 2404 | |
2408 | 2405 | ||
2409 | // This causes the Scene to 'poll' physical objects every couple of frames | 2406 | // This causes the Scene to 'poll' physical objects every couple of frames |
2410 | // bad, so it's been replaced by an event driven method. | 2407 | // bad, so it's been replaced by an event driven method. |
@@ -2422,16 +2419,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
2422 | m_lastAngularVelocity = AngularVelocity; | 2419 | m_lastAngularVelocity = AngularVelocity; |
2423 | m_lastTerseSent = Environment.TickCount; | 2420 | m_lastTerseSent = Environment.TickCount; |
2424 | } | 2421 | } |
2422 | //Moved this outside of the if clause so updates don't get blocked.. *sigh* | ||
2423 | m_updateFlag = 0; //Why were we calling a function to do this? Inefficient! *screams* | ||
2425 | } | 2424 | } |
2426 | else | 2425 | else |
2427 | { | 2426 | { |
2428 | if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes | 2427 | if (m_updateFlag == 2) // is a new prim, just created/reloaded or has major changes |
2429 | { | 2428 | { |
2430 | AddFullUpdateToAllAvatars(); | 2429 | AddFullUpdateToAllAvatars(); |
2431 | ClearUpdateSchedule(); | 2430 | m_updateFlag = 0; //Same here |
2432 | } | 2431 | } |
2433 | } | 2432 | } |
2434 | ClearUpdateSchedule(); | 2433 | m_updateFlag = 0; |
2435 | } | 2434 | } |
2436 | 2435 | ||
2437 | /// <summary> | 2436 | /// <summary> |
@@ -2684,6 +2683,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2684 | SetText(text); | 2683 | SetText(text); |
2685 | } | 2684 | } |
2686 | 2685 | ||
2686 | public void StopLookAt() | ||
2687 | { | ||
2688 | m_parentGroup.stopLookAt(); | ||
2689 | |||
2690 | m_parentGroup.ScheduleGroupForTerseUpdate(); | ||
2691 | } | ||
2692 | |||
2687 | public void StopMoveToTarget() | 2693 | public void StopMoveToTarget() |
2688 | { | 2694 | { |
2689 | m_parentGroup.stopMoveToTarget(); | 2695 | m_parentGroup.stopMoveToTarget(); |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 5604e3d..ce6110a 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -73,7 +73,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
73 | // { | 73 | // { |
74 | // m_log.Debug("[ScenePresence] Destructor called"); | 74 | // m_log.Debug("[ScenePresence] Destructor called"); |
75 | // } | 75 | // } |
76 | 76 | ||
77 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 77 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
78 | 78 | ||
79 | private static readonly byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 }; | 79 | private static readonly byte[] BAKE_INDICES = new byte[] { 8, 9, 10, 11, 19, 20 }; |
@@ -144,7 +144,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
144 | private int m_perfMonMS; | 144 | private int m_perfMonMS; |
145 | 145 | ||
146 | private bool m_setAlwaysRun; | 146 | private bool m_setAlwaysRun; |
147 | |||
148 | private bool m_forceFly; | 147 | private bool m_forceFly; |
149 | private bool m_flyDisabled; | 148 | private bool m_flyDisabled; |
150 | 149 | ||
@@ -168,7 +167,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
168 | protected RegionInfo m_regionInfo; | 167 | protected RegionInfo m_regionInfo; |
169 | protected ulong crossingFromRegion; | 168 | protected ulong crossingFromRegion; |
170 | 169 | ||
171 | private readonly Vector3[] Dir_Vectors = new Vector3[6]; | 170 | private readonly Vector3[] Dir_Vectors = new Vector3[9]; |
171 | private bool m_isNudging = false; | ||
172 | 172 | ||
173 | // Position of agent's camera in world (region cordinates) | 173 | // Position of agent's camera in world (region cordinates) |
174 | protected Vector3 m_CameraCenter; | 174 | protected Vector3 m_CameraCenter; |
@@ -232,6 +232,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
232 | DIR_CONTROL_FLAG_RIGHT = AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG, | 232 | DIR_CONTROL_FLAG_RIGHT = AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG, |
233 | DIR_CONTROL_FLAG_UP = AgentManager.ControlFlags.AGENT_CONTROL_UP_POS, | 233 | DIR_CONTROL_FLAG_UP = AgentManager.ControlFlags.AGENT_CONTROL_UP_POS, |
234 | DIR_CONTROL_FLAG_DOWN = AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG, | 234 | DIR_CONTROL_FLAG_DOWN = AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG, |
235 | DIR_CONTROL_FLAG_FORWARD_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS, | ||
236 | DIR_CONTROL_FLAG_BACK_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG, | ||
235 | DIR_CONTROL_FLAG_DOWN_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG | 237 | DIR_CONTROL_FLAG_DOWN_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG |
236 | } | 238 | } |
237 | 239 | ||
@@ -716,21 +718,41 @@ namespace OpenSim.Region.Framework.Scenes | |||
716 | Dir_Vectors[3] = -Vector3.UnitY; //RIGHT | 718 | Dir_Vectors[3] = -Vector3.UnitY; //RIGHT |
717 | Dir_Vectors[4] = Vector3.UnitZ; //UP | 719 | Dir_Vectors[4] = Vector3.UnitZ; //UP |
718 | Dir_Vectors[5] = -Vector3.UnitZ; //DOWN | 720 | Dir_Vectors[5] = -Vector3.UnitZ; //DOWN |
719 | Dir_Vectors[5] = new Vector3(0f, 0f, -0.5f); //DOWN_Nudge | 721 | Dir_Vectors[6] = new Vector3(0.5f, 0f, 0f); //FORWARD_NUDGE |
722 | Dir_Vectors[7] = new Vector3(-0.5f, 0f, 0f); //BACK_NUDGE | ||
723 | Dir_Vectors[8] = new Vector3(0f, 0f, -0.5f); //DOWN_Nudge | ||
720 | } | 724 | } |
721 | 725 | ||
722 | private Vector3[] GetWalkDirectionVectors() | 726 | private Vector3[] GetWalkDirectionVectors() |
723 | { | 727 | { |
724 | Vector3[] vector = new Vector3[6]; | 728 | Vector3[] vector = new Vector3[9]; |
725 | vector[0] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD | 729 | vector[0] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD |
726 | vector[1] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK | 730 | vector[1] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK |
727 | vector[2] = Vector3.UnitY; //LEFT | 731 | vector[2] = Vector3.UnitY; //LEFT |
728 | vector[3] = -Vector3.UnitY; //RIGHT | 732 | vector[3] = -Vector3.UnitY; //RIGHT |
729 | vector[4] = new Vector3(m_CameraAtAxis.Z, 0f, m_CameraUpAxis.Z); //UP | 733 | vector[4] = new Vector3(m_CameraAtAxis.Z, 0f, m_CameraUpAxis.Z); //UP |
730 | vector[5] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN | 734 | vector[5] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN |
731 | vector[5] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN_Nudge | 735 | vector[6] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD_NUDGE |
736 | vector[7] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK_NUDGE | ||
737 | vector[8] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN_Nudge | ||
732 | return vector; | 738 | return vector; |
733 | } | 739 | } |
740 | |||
741 | private bool[] GetDirectionIsNudge() | ||
742 | { | ||
743 | bool[] isNudge = new bool[9]; | ||
744 | isNudge[0] = false; //FORWARD | ||
745 | isNudge[1] = false; //BACK | ||
746 | isNudge[2] = false; //LEFT | ||
747 | isNudge[3] = false; //RIGHT | ||
748 | isNudge[4] = false; //UP | ||
749 | isNudge[5] = false; //DOWN | ||
750 | isNudge[6] = true; //FORWARD_NUDGE | ||
751 | isNudge[7] = true; //BACK_NUDGE | ||
752 | isNudge[8] = true; //DOWN_Nudge | ||
753 | return isNudge; | ||
754 | } | ||
755 | |||
734 | 756 | ||
735 | #endregion | 757 | #endregion |
736 | 758 | ||
@@ -1147,7 +1169,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1147 | // // m_log.Debug("DEBUG: HandleAgentUpdate: child agent"); | 1169 | // // m_log.Debug("DEBUG: HandleAgentUpdate: child agent"); |
1148 | // return; | 1170 | // return; |
1149 | //} | 1171 | //} |
1150 | |||
1151 | m_perfMonMS = Environment.TickCount; | 1172 | m_perfMonMS = Environment.TickCount; |
1152 | 1173 | ||
1153 | ++m_movementUpdateCount; | 1174 | ++m_movementUpdateCount; |
@@ -1229,7 +1250,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1229 | m_scene.PhysicsScene.RaycastWorld(m_pos, Vector3.Normalize(m_CameraCenter - posAdjusted), Vector3.Distance(m_CameraCenter, posAdjusted) + 0.3f, RayCastCameraCallback); | 1250 | m_scene.PhysicsScene.RaycastWorld(m_pos, Vector3.Normalize(m_CameraCenter - posAdjusted), Vector3.Distance(m_CameraCenter, posAdjusted) + 0.3f, RayCastCameraCallback); |
1230 | } | 1251 | } |
1231 | } | 1252 | } |
1232 | |||
1233 | lock (scriptedcontrols) | 1253 | lock (scriptedcontrols) |
1234 | { | 1254 | { |
1235 | if (scriptedcontrols.Count > 0) | 1255 | if (scriptedcontrols.Count > 0) |
@@ -1261,7 +1281,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1261 | { | 1281 | { |
1262 | return; | 1282 | return; |
1263 | } | 1283 | } |
1264 | |||
1265 | if (m_allowMovement) | 1284 | if (m_allowMovement) |
1266 | { | 1285 | { |
1267 | int i = 0; | 1286 | int i = 0; |
@@ -1289,6 +1308,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1289 | update_rotation = true; | 1308 | update_rotation = true; |
1290 | } | 1309 | } |
1291 | 1310 | ||
1311 | //guilty until proven innocent.. | ||
1312 | bool Nudging = true; | ||
1313 | //Basically, if there is at least one non-nudge control then we don't need | ||
1314 | //to worry about stopping the avatar | ||
1315 | |||
1292 | if (m_parentID == 0) | 1316 | if (m_parentID == 0) |
1293 | { | 1317 | { |
1294 | bool bAllowUpdateMoveToPosition = false; | 1318 | bool bAllowUpdateMoveToPosition = false; |
@@ -1303,6 +1327,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1303 | else | 1327 | else |
1304 | dirVectors = Dir_Vectors; | 1328 | dirVectors = Dir_Vectors; |
1305 | 1329 | ||
1330 | bool[] isNudge = GetDirectionIsNudge(); | ||
1331 | |||
1332 | |||
1333 | |||
1334 | |||
1335 | |||
1306 | foreach (Dir_ControlFlags DCF in DIR_CONTROL_FLAGS) | 1336 | foreach (Dir_ControlFlags DCF in DIR_CONTROL_FLAGS) |
1307 | { | 1337 | { |
1308 | if (((uint)flags & (uint)DCF) != 0) | 1338 | if (((uint)flags & (uint)DCF) != 0) |
@@ -1312,6 +1342,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1312 | try | 1342 | try |
1313 | { | 1343 | { |
1314 | agent_control_v3 += dirVectors[i]; | 1344 | agent_control_v3 += dirVectors[i]; |
1345 | if (isNudge[i] == false) | ||
1346 | { | ||
1347 | Nudging = false; | ||
1348 | } | ||
1315 | } | 1349 | } |
1316 | catch (IndexOutOfRangeException) | 1350 | catch (IndexOutOfRangeException) |
1317 | { | 1351 | { |
@@ -1373,6 +1407,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1373 | // Ignore z component of vector | 1407 | // Ignore z component of vector |
1374 | Vector3 LocalVectorToTarget2D = new Vector3((float)(LocalVectorToTarget3D.X), (float)(LocalVectorToTarget3D.Y), 0f); | 1408 | Vector3 LocalVectorToTarget2D = new Vector3((float)(LocalVectorToTarget3D.X), (float)(LocalVectorToTarget3D.Y), 0f); |
1375 | LocalVectorToTarget2D.Normalize(); | 1409 | LocalVectorToTarget2D.Normalize(); |
1410 | |||
1411 | //We're not nudging | ||
1412 | Nudging = false; | ||
1376 | agent_control_v3 += LocalVectorToTarget2D; | 1413 | agent_control_v3 += LocalVectorToTarget2D; |
1377 | 1414 | ||
1378 | // update avatar movement flags. the avatar coordinate system is as follows: | 1415 | // update avatar movement flags. the avatar coordinate system is as follows: |
@@ -1455,7 +1492,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1455 | // m_log.DebugFormat( | 1492 | // m_log.DebugFormat( |
1456 | // "In {0} adding velocity to {1} of {2}", m_scene.RegionInfo.RegionName, Name, agent_control_v3); | 1493 | // "In {0} adding velocity to {1} of {2}", m_scene.RegionInfo.RegionName, Name, agent_control_v3); |
1457 | 1494 | ||
1458 | AddNewMovement(agent_control_v3, q); | 1495 | AddNewMovement(agent_control_v3, q, Nudging); |
1459 | 1496 | ||
1460 | if (update_movementflag) | 1497 | if (update_movementflag) |
1461 | Animator.UpdateMovementAnimations(); | 1498 | Animator.UpdateMovementAnimations(); |
@@ -1891,7 +1928,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1891 | /// </summary> | 1928 | /// </summary> |
1892 | /// <param name="vec">The vector in which to move. This is relative to the rotation argument</param> | 1929 | /// <param name="vec">The vector in which to move. This is relative to the rotation argument</param> |
1893 | /// <param name="rotation">The direction in which this avatar should now face. | 1930 | /// <param name="rotation">The direction in which this avatar should now face. |
1894 | public void AddNewMovement(Vector3 vec, Quaternion rotation) | 1931 | public void AddNewMovement(Vector3 vec, Quaternion rotation, bool Nudging) |
1895 | { | 1932 | { |
1896 | if (m_isChildAgent) | 1933 | if (m_isChildAgent) |
1897 | { | 1934 | { |
@@ -1965,7 +2002,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1965 | 2002 | ||
1966 | // TODO: Add the force instead of only setting it to support multiple forces per frame? | 2003 | // TODO: Add the force instead of only setting it to support multiple forces per frame? |
1967 | m_forceToApply = direc; | 2004 | m_forceToApply = direc; |
1968 | 2005 | m_isNudging = Nudging; | |
1969 | m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); | 2006 | m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); |
1970 | } | 2007 | } |
1971 | 2008 | ||
@@ -1980,7 +2017,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1980 | const float POSITION_TOLERANCE = 0.05f; | 2017 | const float POSITION_TOLERANCE = 0.05f; |
1981 | //const int TIME_MS_TOLERANCE = 3000; | 2018 | //const int TIME_MS_TOLERANCE = 3000; |
1982 | 2019 | ||
1983 | SendPrimUpdates(); | 2020 | |
1984 | 2021 | ||
1985 | if (m_newCoarseLocations) | 2022 | if (m_newCoarseLocations) |
1986 | { | 2023 | { |
@@ -2016,6 +2053,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2016 | CheckForBorderCrossing(); | 2053 | CheckForBorderCrossing(); |
2017 | CheckForSignificantMovement(); // sends update to the modules. | 2054 | CheckForSignificantMovement(); // sends update to the modules. |
2018 | } | 2055 | } |
2056 | |||
2057 | //Sending prim updates AFTER the avatar terse updates are sent | ||
2058 | SendPrimUpdates(); | ||
2019 | } | 2059 | } |
2020 | 2060 | ||
2021 | #endregion | 2061 | #endregion |
@@ -2869,14 +2909,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2869 | { | 2909 | { |
2870 | if (m_forceToApply.HasValue) | 2910 | if (m_forceToApply.HasValue) |
2871 | { | 2911 | { |
2872 | Vector3 force = m_forceToApply.Value; | ||
2873 | 2912 | ||
2913 | Vector3 force = m_forceToApply.Value; | ||
2874 | m_updateflag = true; | 2914 | m_updateflag = true; |
2875 | // movementvector = force; | ||
2876 | Velocity = force; | 2915 | Velocity = force; |
2877 | 2916 | ||
2878 | m_forceToApply = null; | 2917 | m_forceToApply = null; |
2879 | } | 2918 | } |
2919 | else | ||
2920 | { | ||
2921 | if (m_isNudging) | ||
2922 | { | ||
2923 | Vector3 force = Vector3.Zero; | ||
2924 | |||
2925 | m_updateflag = true; | ||
2926 | Velocity = force; | ||
2927 | m_isNudging = false; | ||
2928 | } | ||
2929 | } | ||
2880 | } | 2930 | } |
2881 | 2931 | ||
2882 | public override void SetText(string text, Vector3 color, double alpha) | 2932 | public override void SetText(string text, Vector3 color, double alpha) |