diff options
Diffstat (limited to 'OpenSim/Region/Framework')
5 files changed, 150 insertions, 46 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index cbe4118..30a95ce 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs | |||
@@ -39,7 +39,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
39 | /// Handle all animation duties for a scene presence | 39 | /// Handle all animation duties for a scene presence |
40 | /// </summary> | 40 | /// </summary> |
41 | public class ScenePresenceAnimator | 41 | public class ScenePresenceAnimator |
42 | { | 42 | { |
43 | public AnimationSet Animations | 43 | public AnimationSet Animations |
44 | { | 44 | { |
45 | get { return m_animations; } | 45 | get { return m_animations; } |
@@ -53,19 +53,19 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
53 | { | 53 | { |
54 | get { return m_movementAnimation; } | 54 | get { return m_movementAnimation; } |
55 | } | 55 | } |
56 | protected string m_movementAnimation = "DEFAULT"; | 56 | protected string m_movementAnimation = "DEFAULT"; |
57 | 57 | ||
58 | private int m_animTickFall; | 58 | private int m_animTickFall; |
59 | private int m_animTickJump; | 59 | private int m_animTickJump; |
60 | 60 | ||
61 | /// <value> | 61 | /// <value> |
62 | /// The scene presence that this animator applies to | 62 | /// The scene presence that this animator applies to |
63 | /// </value> | 63 | /// </value> |
64 | protected ScenePresence m_scenePresence; | 64 | protected ScenePresence m_scenePresence; |
65 | 65 | ||
66 | public ScenePresenceAnimator(ScenePresence sp) | 66 | public ScenePresenceAnimator(ScenePresence sp) |
67 | { | 67 | { |
68 | m_scenePresence = sp; | 68 | m_scenePresence = sp; |
69 | } | 69 | } |
70 | 70 | ||
71 | public void AddAnimation(UUID animID, UUID objectID) | 71 | public void AddAnimation(UUID animID, UUID objectID) |
@@ -110,11 +110,11 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
110 | return; | 110 | return; |
111 | 111 | ||
112 | RemoveAnimation(animID); | 112 | RemoveAnimation(animID); |
113 | } | 113 | } |
114 | 114 | ||
115 | public void ResetAnimations() | 115 | public void ResetAnimations() |
116 | { | 116 | { |
117 | m_animations.Clear(); | 117 | m_animations.Clear(); |
118 | } | 118 | } |
119 | 119 | ||
120 | /// <summary> | 120 | /// <summary> |
@@ -131,7 +131,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
131 | anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, UUID.Zero)) | 131 | anim, m_scenePresence.ControllingClient.NextAnimationSequenceNumber, UUID.Zero)) |
132 | { | 132 | { |
133 | // 16384 is CHANGED_ANIMATION | 133 | // 16384 is CHANGED_ANIMATION |
134 | m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { 16384 }); | 134 | m_scenePresence.SendScriptEventToAttachments("changed", new Object[] { 16384 }); |
135 | SendAnimPack(); | 135 | SendAnimPack(); |
136 | } | 136 | } |
137 | } | 137 | } |
@@ -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; |
@@ -305,7 +305,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
305 | #endregion Ground Movement | 305 | #endregion Ground Movement |
306 | 306 | ||
307 | return m_movementAnimation; | 307 | return m_movementAnimation; |
308 | } | 308 | } |
309 | 309 | ||
310 | /// <summary> | 310 | /// <summary> |
311 | /// Update the movement animation of this avatar according to its current state | 311 | /// Update the movement animation of this avatar according to its current state |
@@ -391,7 +391,7 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
391 | m_scenePresence.Scene.AssetService.Store(Animasset); | 391 | m_scenePresence.Scene.AssetService.Store(Animasset); |
392 | AddAnimation(Animasset.FullID, m_scenePresence.UUID); | 392 | AddAnimation(Animasset.FullID, m_scenePresence.UUID); |
393 | return anim; | 393 | return anim; |
394 | } | 394 | } |
395 | 395 | ||
396 | /// <summary> | 396 | /// <summary> |
397 | /// | 397 | /// |
@@ -443,6 +443,6 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
443 | m_animations.GetArrays(out animIDs, out sequenceNums, out objectIDs); | 443 | m_animations.GetArrays(out animIDs, out sequenceNums, out objectIDs); |
444 | 444 | ||
445 | SendAnimPack(animIDs, sequenceNums, objectIDs); | 445 | SendAnimPack(animIDs, sequenceNums, objectIDs); |
446 | } | 446 | } |
447 | } | 447 | } |
448 | } \ No newline at end of file | 448 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 2e15b86..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(); |
@@ -1266,7 +1266,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1266 | // allocations, and there is no more work to be done until someone logs in | 1266 | // allocations, and there is no more work to be done until someone logs in |
1267 | GC.Collect(); | 1267 | GC.Collect(); |
1268 | 1268 | ||
1269 | m_log.DebugFormat("[REGION]: Enabling Logins for {0}", RegionInfo.RegionName); | 1269 | m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName); |
1270 | loginsdisabled = false; | 1270 | loginsdisabled = false; |
1271 | } | 1271 | } |
1272 | } | 1272 | } |
@@ -3470,6 +3470,49 @@ namespace OpenSim.Region.Framework.Scenes | |||
3470 | agent.startpos.Y = crossedBorder.BorderLine.Z - 1; | 3470 | agent.startpos.Y = crossedBorder.BorderLine.Z - 1; |
3471 | } | 3471 | } |
3472 | 3472 | ||
3473 | //Mitigate http://opensimulator.org/mantis/view.php?id=3522 | ||
3474 | // Check if start position is outside of region | ||
3475 | // If it is, check the Z start position also.. if not, leave it alone. | ||
3476 | if (BordersLocked) | ||
3477 | { | ||
3478 | lock (EastBorders) | ||
3479 | { | ||
3480 | if (agent.startpos.X > EastBorders[0].BorderLine.Z) | ||
3481 | { | ||
3482 | m_log.Warn("FIX AGENT POSITION"); | ||
3483 | agent.startpos.X = EastBorders[0].BorderLine.Z * 0.5f; | ||
3484 | if (agent.startpos.Z > 720) | ||
3485 | agent.startpos.Z = 720; | ||
3486 | } | ||
3487 | } | ||
3488 | lock (NorthBorders) | ||
3489 | { | ||
3490 | if (agent.startpos.Y > NorthBorders[0].BorderLine.Z) | ||
3491 | { | ||
3492 | m_log.Warn("FIX Agent POSITION"); | ||
3493 | agent.startpos.Y = NorthBorders[0].BorderLine.Z * 0.5f; | ||
3494 | if (agent.startpos.Z > 720) | ||
3495 | agent.startpos.Z = 720; | ||
3496 | } | ||
3497 | } | ||
3498 | } | ||
3499 | else | ||
3500 | { | ||
3501 | if (agent.startpos.X > EastBorders[0].BorderLine.Z) | ||
3502 | { | ||
3503 | m_log.Warn("FIX AGENT POSITION"); | ||
3504 | agent.startpos.X = EastBorders[0].BorderLine.Z * 0.5f; | ||
3505 | if (agent.startpos.Z > 720) | ||
3506 | agent.startpos.Z = 720; | ||
3507 | } | ||
3508 | if (agent.startpos.Y > NorthBorders[0].BorderLine.Z) | ||
3509 | { | ||
3510 | m_log.Warn("FIX Agent POSITION"); | ||
3511 | agent.startpos.Y = NorthBorders[0].BorderLine.Z * 0.5f; | ||
3512 | if (agent.startpos.Z > 720) | ||
3513 | agent.startpos.Z = 720; | ||
3514 | } | ||
3515 | } | ||
3473 | // Honor parcel landing type and position. | 3516 | // Honor parcel landing type and position. |
3474 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); | 3517 | ILandObject land = LandChannel.GetLandObject(agent.startpos.X, agent.startpos.Y); |
3475 | if (land != null) | 3518 | if (land != null) |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index bf2f3d3..cdec135 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -2075,6 +2075,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2075 | { | 2075 | { |
2076 | if (PhysActor != null) | 2076 | if (PhysActor != null) |
2077 | { | 2077 | { |
2078 | |||
2078 | Vector3 newpos = new Vector3(PhysActor.Position.GetBytes(), 0); | 2079 | Vector3 newpos = new Vector3(PhysActor.Position.GetBytes(), 0); |
2079 | 2080 | ||
2080 | if (m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.N) | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.S) | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.E) | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.W)) | 2081 | if (m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.N) | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.S) | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.E) | m_parentGroup.Scene.TestBorderCross(newpos, Cardinals.W)) |
@@ -2082,6 +2083,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2082 | m_parentGroup.AbsolutePosition = newpos; | 2083 | m_parentGroup.AbsolutePosition = newpos; |
2083 | return; | 2084 | return; |
2084 | } | 2085 | } |
2086 | //m_parentGroup.RootPart.m_groupPosition = newpos; | ||
2085 | } | 2087 | } |
2086 | ScheduleTerseUpdate(); | 2088 | ScheduleTerseUpdate(); |
2087 | 2089 | ||
@@ -2393,6 +2395,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2393 | if (!RotationOffset.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) || | 2395 | if (!RotationOffset.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) || |
2394 | !Acceleration.Equals(m_lastAcceleration) || | 2396 | !Acceleration.Equals(m_lastAcceleration) || |
2395 | !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) || | 2397 | !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) || |
2398 | Velocity.ApproxEquals(Vector3.Zero, VELOCITY_TOLERANCE) || | ||
2396 | !AngularVelocity.ApproxEquals(m_lastAngularVelocity, VELOCITY_TOLERANCE) || | 2399 | !AngularVelocity.ApproxEquals(m_lastAngularVelocity, VELOCITY_TOLERANCE) || |
2397 | !OffsetPosition.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) || | 2400 | !OffsetPosition.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) || |
2398 | Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) | 2401 | Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) |
@@ -2427,6 +2430,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2427 | m_updateFlag = 0; //Same here | 2430 | m_updateFlag = 0; //Same here |
2428 | } | 2431 | } |
2429 | } | 2432 | } |
2433 | m_updateFlag = 0; | ||
2430 | } | 2434 | } |
2431 | 2435 | ||
2432 | /// <summary> | 2436 | /// <summary> |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index aa538dc..4e5fee1 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 }; |
@@ -146,7 +146,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
146 | private int m_perfMonMS; | 146 | private int m_perfMonMS; |
147 | 147 | ||
148 | private bool m_setAlwaysRun; | 148 | private bool m_setAlwaysRun; |
149 | |||
150 | private bool m_forceFly; | 149 | private bool m_forceFly; |
151 | private bool m_flyDisabled; | 150 | private bool m_flyDisabled; |
152 | 151 | ||
@@ -154,6 +153,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
154 | 153 | ||
155 | private Quaternion m_bodyRot= Quaternion.Identity; | 154 | private Quaternion m_bodyRot= Quaternion.Identity; |
156 | 155 | ||
156 | private const int LAND_VELOCITYMAG_MAX = 12; | ||
157 | |||
157 | public bool IsRestrictedToRegion; | 158 | public bool IsRestrictedToRegion; |
158 | 159 | ||
159 | public string JID = String.Empty; | 160 | public string JID = String.Empty; |
@@ -168,7 +169,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
168 | protected RegionInfo m_regionInfo; | 169 | protected RegionInfo m_regionInfo; |
169 | protected ulong crossingFromRegion; | 170 | protected ulong crossingFromRegion; |
170 | 171 | ||
171 | private readonly Vector3[] Dir_Vectors = new Vector3[6]; | 172 | private readonly Vector3[] Dir_Vectors = new Vector3[9]; |
173 | private bool m_isNudging = false; | ||
172 | 174 | ||
173 | // Position of agent's camera in world (region cordinates) | 175 | // Position of agent's camera in world (region cordinates) |
174 | protected Vector3 m_CameraCenter; | 176 | protected Vector3 m_CameraCenter; |
@@ -232,6 +234,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
232 | DIR_CONTROL_FLAG_RIGHT = AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG, | 234 | DIR_CONTROL_FLAG_RIGHT = AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG, |
233 | DIR_CONTROL_FLAG_UP = AgentManager.ControlFlags.AGENT_CONTROL_UP_POS, | 235 | DIR_CONTROL_FLAG_UP = AgentManager.ControlFlags.AGENT_CONTROL_UP_POS, |
234 | DIR_CONTROL_FLAG_DOWN = AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG, | 236 | DIR_CONTROL_FLAG_DOWN = AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG, |
237 | DIR_CONTROL_FLAG_FORWARD_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS, | ||
238 | 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 | 239 | DIR_CONTROL_FLAG_DOWN_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG |
236 | } | 240 | } |
237 | 241 | ||
@@ -247,7 +251,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
247 | /// <value> | 251 | /// <value> |
248 | /// Script engines present in the scene | 252 | /// Script engines present in the scene |
249 | /// </value> | 253 | /// </value> |
250 | private IScriptModule[] m_scriptEngines; | 254 | private IScriptModule[] m_scriptEngines; |
251 | 255 | ||
252 | #region Properties | 256 | #region Properties |
253 | 257 | ||
@@ -674,7 +678,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
674 | AvatarWearable[] wearables) | 678 | AvatarWearable[] wearables) |
675 | : this(client, world, reginfo) | 679 | : this(client, world, reginfo) |
676 | { | 680 | { |
677 | m_appearance = new AvatarAppearance(m_uuid, wearables, visualParams); | 681 | m_appearance = new AvatarAppearance(m_uuid, wearables, visualParams); |
678 | } | 682 | } |
679 | 683 | ||
680 | public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance) | 684 | public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, AvatarAppearance appearance) |
@@ -716,21 +720,41 @@ namespace OpenSim.Region.Framework.Scenes | |||
716 | Dir_Vectors[3] = -Vector3.UnitY; //RIGHT | 720 | Dir_Vectors[3] = -Vector3.UnitY; //RIGHT |
717 | Dir_Vectors[4] = Vector3.UnitZ; //UP | 721 | Dir_Vectors[4] = Vector3.UnitZ; //UP |
718 | Dir_Vectors[5] = -Vector3.UnitZ; //DOWN | 722 | Dir_Vectors[5] = -Vector3.UnitZ; //DOWN |
719 | Dir_Vectors[5] = new Vector3(0f, 0f, -0.5f); //DOWN_Nudge | 723 | Dir_Vectors[6] = new Vector3(0.5f, 0f, 0f); //FORWARD_NUDGE |
724 | Dir_Vectors[7] = new Vector3(-0.5f, 0f, 0f); //BACK_NUDGE | ||
725 | Dir_Vectors[8] = new Vector3(0f, 0f, -0.5f); //DOWN_Nudge | ||
720 | } | 726 | } |
721 | 727 | ||
722 | private Vector3[] GetWalkDirectionVectors() | 728 | private Vector3[] GetWalkDirectionVectors() |
723 | { | 729 | { |
724 | Vector3[] vector = new Vector3[6]; | 730 | Vector3[] vector = new Vector3[9]; |
725 | vector[0] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD | 731 | 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 | 732 | vector[1] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK |
727 | vector[2] = Vector3.UnitY; //LEFT | 733 | vector[2] = Vector3.UnitY; //LEFT |
728 | vector[3] = -Vector3.UnitY; //RIGHT | 734 | vector[3] = -Vector3.UnitY; //RIGHT |
729 | vector[4] = new Vector3(m_CameraAtAxis.Z, 0f, m_CameraUpAxis.Z); //UP | 735 | 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 | 736 | 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 | 737 | vector[6] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD_NUDGE |
738 | vector[7] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK_NUDGE | ||
739 | vector[8] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN_Nudge | ||
732 | return vector; | 740 | return vector; |
733 | } | 741 | } |
742 | |||
743 | private bool[] GetDirectionIsNudge() | ||
744 | { | ||
745 | bool[] isNudge = new bool[9]; | ||
746 | isNudge[0] = false; //FORWARD | ||
747 | isNudge[1] = false; //BACK | ||
748 | isNudge[2] = false; //LEFT | ||
749 | isNudge[3] = false; //RIGHT | ||
750 | isNudge[4] = false; //UP | ||
751 | isNudge[5] = false; //DOWN | ||
752 | isNudge[6] = true; //FORWARD_NUDGE | ||
753 | isNudge[7] = true; //BACK_NUDGE | ||
754 | isNudge[8] = true; //DOWN_Nudge | ||
755 | return isNudge; | ||
756 | } | ||
757 | |||
734 | 758 | ||
735 | #endregion | 759 | #endregion |
736 | 760 | ||
@@ -980,8 +1004,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
980 | public void StopFlying() | 1004 | public void StopFlying() |
981 | { | 1005 | { |
982 | // It turns out to get the agent to stop flying, you have to feed it stop flying velocities | 1006 | // It turns out to get the agent to stop flying, you have to feed it stop flying velocities |
983 | // and send a full object update. | 1007 | // There's no explicit message to send the client to tell it to stop flying.. it relies on the |
984 | // There's no message to send the client to tell it to stop flying | 1008 | // velocity, collision plane and avatar height |
985 | 1009 | ||
986 | // Add 1/6 the avatar's height to it's position so it doesn't shoot into the air | 1010 | // Add 1/6 the avatar's height to it's position so it doesn't shoot into the air |
987 | // when the avatar stands up | 1011 | // when the avatar stands up |
@@ -995,8 +1019,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
995 | AbsolutePosition = AbsolutePosition + new Vector3(0f, 0f, (1.56f / 6f)); | 1019 | AbsolutePosition = AbsolutePosition + new Vector3(0f, 0f, (1.56f / 6f)); |
996 | } | 1020 | } |
997 | 1021 | ||
998 | Animator.TrySetMovementAnimation("LAND"); | 1022 | ControllingClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_rootRegionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId, |
999 | SendFullUpdateToAllClients(); | 1023 | AbsolutePosition, Velocity, Vector3.Zero, m_bodyRot, new Vector4(0,0,1,AbsolutePosition.Z - 0.5f), m_uuid, null, GetUpdatePriority(ControllingClient))); |
1000 | } | 1024 | } |
1001 | 1025 | ||
1002 | public void AddNeighbourRegion(ulong regionHandle, string cap) | 1026 | public void AddNeighbourRegion(ulong regionHandle, string cap) |
@@ -1147,7 +1171,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1147 | // // m_log.Debug("DEBUG: HandleAgentUpdate: child agent"); | 1171 | // // m_log.Debug("DEBUG: HandleAgentUpdate: child agent"); |
1148 | // return; | 1172 | // return; |
1149 | //} | 1173 | //} |
1150 | |||
1151 | m_perfMonMS = Environment.TickCount; | 1174 | m_perfMonMS = Environment.TickCount; |
1152 | 1175 | ||
1153 | ++m_movementUpdateCount; | 1176 | ++m_movementUpdateCount; |
@@ -1229,7 +1252,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); | 1252 | m_scene.PhysicsScene.RaycastWorld(m_pos, Vector3.Normalize(m_CameraCenter - posAdjusted), Vector3.Distance(m_CameraCenter, posAdjusted) + 0.3f, RayCastCameraCallback); |
1230 | } | 1253 | } |
1231 | } | 1254 | } |
1232 | |||
1233 | lock (scriptedcontrols) | 1255 | lock (scriptedcontrols) |
1234 | { | 1256 | { |
1235 | if (scriptedcontrols.Count > 0) | 1257 | if (scriptedcontrols.Count > 0) |
@@ -1261,7 +1283,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1261 | { | 1283 | { |
1262 | return; | 1284 | return; |
1263 | } | 1285 | } |
1264 | |||
1265 | if (m_allowMovement) | 1286 | if (m_allowMovement) |
1266 | { | 1287 | { |
1267 | int i = 0; | 1288 | int i = 0; |
@@ -1289,6 +1310,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1289 | update_rotation = true; | 1310 | update_rotation = true; |
1290 | } | 1311 | } |
1291 | 1312 | ||
1313 | //guilty until proven innocent.. | ||
1314 | bool Nudging = true; | ||
1315 | //Basically, if there is at least one non-nudge control then we don't need | ||
1316 | //to worry about stopping the avatar | ||
1317 | |||
1292 | if (m_parentID == 0) | 1318 | if (m_parentID == 0) |
1293 | { | 1319 | { |
1294 | bool bAllowUpdateMoveToPosition = false; | 1320 | bool bAllowUpdateMoveToPosition = false; |
@@ -1303,6 +1329,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1303 | else | 1329 | else |
1304 | dirVectors = Dir_Vectors; | 1330 | dirVectors = Dir_Vectors; |
1305 | 1331 | ||
1332 | bool[] isNudge = GetDirectionIsNudge(); | ||
1333 | |||
1334 | |||
1335 | |||
1336 | |||
1337 | |||
1306 | foreach (Dir_ControlFlags DCF in DIR_CONTROL_FLAGS) | 1338 | foreach (Dir_ControlFlags DCF in DIR_CONTROL_FLAGS) |
1307 | { | 1339 | { |
1308 | if (((uint)flags & (uint)DCF) != 0) | 1340 | if (((uint)flags & (uint)DCF) != 0) |
@@ -1312,6 +1344,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1312 | try | 1344 | try |
1313 | { | 1345 | { |
1314 | agent_control_v3 += dirVectors[i]; | 1346 | agent_control_v3 += dirVectors[i]; |
1347 | if (isNudge[i] == false) | ||
1348 | { | ||
1349 | Nudging = false; | ||
1350 | } | ||
1315 | } | 1351 | } |
1316 | catch (IndexOutOfRangeException) | 1352 | catch (IndexOutOfRangeException) |
1317 | { | 1353 | { |
@@ -1373,6 +1409,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1373 | // Ignore z component of vector | 1409 | // Ignore z component of vector |
1374 | Vector3 LocalVectorToTarget2D = new Vector3((float)(LocalVectorToTarget3D.X), (float)(LocalVectorToTarget3D.Y), 0f); | 1410 | Vector3 LocalVectorToTarget2D = new Vector3((float)(LocalVectorToTarget3D.X), (float)(LocalVectorToTarget3D.Y), 0f); |
1375 | LocalVectorToTarget2D.Normalize(); | 1411 | LocalVectorToTarget2D.Normalize(); |
1412 | |||
1413 | //We're not nudging | ||
1414 | Nudging = false; | ||
1376 | agent_control_v3 += LocalVectorToTarget2D; | 1415 | agent_control_v3 += LocalVectorToTarget2D; |
1377 | 1416 | ||
1378 | // update avatar movement flags. the avatar coordinate system is as follows: | 1417 | // update avatar movement flags. the avatar coordinate system is as follows: |
@@ -1431,6 +1470,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1431 | // Only do this if we're flying | 1470 | // Only do this if we're flying |
1432 | if (m_physicsActor != null && m_physicsActor.Flying && !m_forceFly) | 1471 | if (m_physicsActor != null && m_physicsActor.Flying && !m_forceFly) |
1433 | { | 1472 | { |
1473 | // Landing detection code | ||
1474 | |||
1434 | // Are the landing controls requirements filled? | 1475 | // Are the landing controls requirements filled? |
1435 | bool controlland = (((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || | 1476 | bool controlland = (((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || |
1436 | ((flags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)); | 1477 | ((flags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)); |
@@ -1440,7 +1481,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1440 | 1481 | ||
1441 | if (m_physicsActor.Flying && colliding && controlland) | 1482 | if (m_physicsActor.Flying && colliding && controlland) |
1442 | { | 1483 | { |
1443 | StopFlying(); | 1484 | // nesting this check because LengthSquared() is expensive and we don't |
1485 | // want to do it every step when flying. | ||
1486 | if ((Velocity.LengthSquared() <= LAND_VELOCITYMAG_MAX)) | ||
1487 | StopFlying(); | ||
1444 | } | 1488 | } |
1445 | } | 1489 | } |
1446 | 1490 | ||
@@ -1450,7 +1494,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1450 | // m_log.DebugFormat( | 1494 | // m_log.DebugFormat( |
1451 | // "In {0} adding velocity to {1} of {2}", m_scene.RegionInfo.RegionName, Name, agent_control_v3); | 1495 | // "In {0} adding velocity to {1} of {2}", m_scene.RegionInfo.RegionName, Name, agent_control_v3); |
1452 | 1496 | ||
1453 | AddNewMovement(agent_control_v3, q); | 1497 | AddNewMovement(agent_control_v3, q, Nudging); |
1454 | 1498 | ||
1455 | if (update_movementflag) | 1499 | if (update_movementflag) |
1456 | Animator.UpdateMovementAnimations(); | 1500 | Animator.UpdateMovementAnimations(); |
@@ -1923,7 +1967,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1923 | /// </summary> | 1967 | /// </summary> |
1924 | /// <param name="vec">The vector in which to move. This is relative to the rotation argument</param> | 1968 | /// <param name="vec">The vector in which to move. This is relative to the rotation argument</param> |
1925 | /// <param name="rotation">The direction in which this avatar should now face. | 1969 | /// <param name="rotation">The direction in which this avatar should now face. |
1926 | public void AddNewMovement(Vector3 vec, Quaternion rotation) | 1970 | public void AddNewMovement(Vector3 vec, Quaternion rotation, bool Nudging) |
1927 | { | 1971 | { |
1928 | if (m_isChildAgent) | 1972 | if (m_isChildAgent) |
1929 | { | 1973 | { |
@@ -1997,7 +2041,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1997 | 2041 | ||
1998 | // TODO: Add the force instead of only setting it to support multiple forces per frame? | 2042 | // TODO: Add the force instead of only setting it to support multiple forces per frame? |
1999 | m_forceToApply = direc; | 2043 | m_forceToApply = direc; |
2000 | 2044 | m_isNudging = Nudging; | |
2001 | m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); | 2045 | m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); |
2002 | } | 2046 | } |
2003 | 2047 | ||
@@ -2012,7 +2056,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2012 | const float POSITION_TOLERANCE = 0.05f; | 2056 | const float POSITION_TOLERANCE = 0.05f; |
2013 | //const int TIME_MS_TOLERANCE = 3000; | 2057 | //const int TIME_MS_TOLERANCE = 3000; |
2014 | 2058 | ||
2015 | SendPrimUpdates(); | 2059 | |
2016 | 2060 | ||
2017 | if (m_newCoarseLocations) | 2061 | if (m_newCoarseLocations) |
2018 | { | 2062 | { |
@@ -2048,6 +2092,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2048 | CheckForBorderCrossing(); | 2092 | CheckForBorderCrossing(); |
2049 | CheckForSignificantMovement(); // sends update to the modules. | 2093 | CheckForSignificantMovement(); // sends update to the modules. |
2050 | } | 2094 | } |
2095 | |||
2096 | //Sending prim updates AFTER the avatar terse updates are sent | ||
2097 | SendPrimUpdates(); | ||
2051 | } | 2098 | } |
2052 | 2099 | ||
2053 | #endregion | 2100 | #endregion |
@@ -2901,14 +2948,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2901 | { | 2948 | { |
2902 | if (m_forceToApply.HasValue) | 2949 | if (m_forceToApply.HasValue) |
2903 | { | 2950 | { |
2904 | Vector3 force = m_forceToApply.Value; | ||
2905 | 2951 | ||
2952 | Vector3 force = m_forceToApply.Value; | ||
2906 | m_updateflag = true; | 2953 | m_updateflag = true; |
2907 | // movementvector = force; | ||
2908 | Velocity = force; | 2954 | Velocity = force; |
2909 | 2955 | ||
2910 | m_forceToApply = null; | 2956 | m_forceToApply = null; |
2911 | } | 2957 | } |
2958 | else | ||
2959 | { | ||
2960 | if (m_isNudging) | ||
2961 | { | ||
2962 | Vector3 force = Vector3.Zero; | ||
2963 | |||
2964 | m_updateflag = true; | ||
2965 | Velocity = force; | ||
2966 | m_isNudging = false; | ||
2967 | } | ||
2968 | } | ||
2912 | } | 2969 | } |
2913 | 2970 | ||
2914 | public override void SetText(string text, Vector3 color, double alpha) | 2971 | public override void SetText(string text, Vector3 color, double alpha) |
@@ -3084,7 +3141,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3084 | 3141 | ||
3085 | public ScenePresence() | 3142 | public ScenePresence() |
3086 | { | 3143 | { |
3087 | m_sendCourseLocationsMethod = SendCoarseLocationsDefault; | 3144 | m_sendCourseLocationsMethod = SendCoarseLocationsDefault; |
3088 | CreateSceneViewer(); | 3145 | CreateSceneViewer(); |
3089 | m_animator = new ScenePresenceAnimator(this); | 3146 | m_animator = new ScenePresenceAnimator(this); |
3090 | } | 3147 | } |
@@ -3172,8 +3229,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3172 | } | 3229 | } |
3173 | } | 3230 | } |
3174 | } | 3231 | } |
3175 | } | 3232 | } |
3176 | } | 3233 | } |
3177 | 3234 | ||
3178 | public bool CrossAttachmentsIntoNewRegion(ulong regionHandle, bool silent) | 3235 | public bool CrossAttachmentsIntoNewRegion(ulong regionHandle, bool silent) |
3179 | { | 3236 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs index b68a044..a36c4db 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/UuidGathererTests.cs | |||
@@ -65,7 +65,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
65 | m_uuidGatherer.GatherAssetUuids(corruptAssetUuid, AssetType.Object, foundAssetUuids); | 65 | m_uuidGatherer.GatherAssetUuids(corruptAssetUuid, AssetType.Object, foundAssetUuids); |
66 | 66 | ||
67 | // We count the uuid as gathered even if the asset itself is corrupt. | 67 | // We count the uuid as gathered even if the asset itself is corrupt. |
68 | Assert.That(foundAssetUuids.Count, Is.EqualTo(1)); | 68 | Assert.That(foundAssetUuids.Count, Is.EqualTo(1)); |
69 | } | 69 | } |
70 | 70 | ||
71 | /// <summary> | 71 | /// <summary> |
@@ -76,7 +76,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
76 | { | 76 | { |
77 | TestHelper.InMethod(); | 77 | TestHelper.InMethod(); |
78 | 78 | ||
79 | UUID missingAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666"); | 79 | UUID missingAssetUuid = UUID.Parse("00000000-0000-0000-0000-000000000666"); |
80 | IDictionary<UUID, int> foundAssetUuids = new Dictionary<UUID, int>(); | 80 | IDictionary<UUID, int> foundAssetUuids = new Dictionary<UUID, int>(); |
81 | 81 | ||
82 | m_uuidGatherer.GatherAssetUuids(missingAssetUuid, AssetType.Object, foundAssetUuids); | 82 | m_uuidGatherer.GatherAssetUuids(missingAssetUuid, AssetType.Object, foundAssetUuids); |