aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJohn Hurliman2009-10-29 16:31:48 -0700
committerJohn Hurliman2009-10-29 16:31:48 -0700
commitaecaa5106394ea55b2442da74b72094f934a491c (patch)
treecd70e3b7d6254397dee675d799b91888214168d9
parent* Commented out two noisy debug lines in the LLUDP server (diff)
downloadopensim-SC_OLD-aecaa5106394ea55b2442da74b72094f934a491c.zip
opensim-SC_OLD-aecaa5106394ea55b2442da74b72094f934a491c.tar.gz
opensim-SC_OLD-aecaa5106394ea55b2442da74b72094f934a491c.tar.bz2
opensim-SC_OLD-aecaa5106394ea55b2442da74b72094f934a491c.tar.xz
* Fixed a NullReferenceException in GetMovementAnimation() and added more protection against NREs in AddNewMovement()
* Removed the three second limit on ImprovedTerseObjectUpdate. With the latest fixes I don't think this is necessary, and it generates a lot of unnecessary updates in a crowded sim
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs64
1 files changed, 35 insertions, 29 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 04c22d0..9730cd5 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -98,7 +98,7 @@ namespace OpenSim.Region.Framework.Scenes
98 private Vector3 m_lastPosition; 98 private Vector3 m_lastPosition;
99 private Quaternion m_lastRotation; 99 private Quaternion m_lastRotation;
100 private Vector3 m_lastVelocity; 100 private Vector3 m_lastVelocity;
101 private int m_lastTerseSent; 101 //private int m_lastTerseSent;
102 102
103 private bool m_updateflag; 103 private bool m_updateflag;
104 private byte m_movementflag; 104 private byte m_movementflag;
@@ -1120,7 +1120,7 @@ namespace OpenSim.Region.Framework.Scenes
1120 else 1120 else
1121 { 1121 {
1122 if (!m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) || 1122 if (!m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) ||
1123 !m_velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) || 1123 !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) ||
1124 !m_bodyRot.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE)) 1124 !m_bodyRot.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE))
1125 { 1125 {
1126 if (CameraConstraintActive) 1126 if (CameraConstraintActive)
@@ -2110,8 +2110,9 @@ namespace OpenSim.Region.Framework.Scenes
2110 if (actor == null || !actor.IsColliding) 2110 if (actor == null || !actor.IsColliding)
2111 { 2111 {
2112 float fallElapsed = (float)(Environment.TickCount - m_animTickFall) / 1000f; 2112 float fallElapsed = (float)(Environment.TickCount - m_animTickFall) / 1000f;
2113 float fallVelocity = (actor != null) ? actor.Velocity.Z : 0.0f;
2113 2114
2114 if (m_animTickFall == 0 || (fallElapsed > FALL_DELAY && actor.Velocity.Z >= 0.0f)) 2115 if (m_animTickFall == 0 || (fallElapsed > FALL_DELAY && fallVelocity >= 0.0f))
2115 { 2116 {
2116 // Just started falling 2117 // Just started falling
2117 m_animTickFall = Environment.TickCount; 2118 m_animTickFall = Environment.TickCount;
@@ -2262,28 +2263,30 @@ namespace OpenSim.Region.Framework.Scenes
2262 direc.Normalize(); 2263 direc.Normalize();
2263 2264
2264 direc *= 0.03f * 128f * m_speedModifier; 2265 direc *= 0.03f * 128f * m_speedModifier;
2265 if (m_physicsActor.Flying) 2266
2266 { 2267 PhysicsActor actor = m_physicsActor;
2267 direc *= 4.0f; 2268 if (actor != null)
2268 //bool controlland = (((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)); 2269 {
2269 //bool colliding = (m_physicsActor.IsColliding==true); 2270 if (actor.Flying)
2270 //if (controlland) 2271 {
2271 // m_log.Info("[AGENT]: landCommand"); 2272 direc *= 4.0f;
2272 //if (colliding) 2273 //bool controlland = (((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0));
2273 // m_log.Info("[AGENT]: colliding"); 2274 //bool colliding = (m_physicsActor.IsColliding==true);
2274 //if (m_physicsActor.Flying && colliding && controlland) 2275 //if (controlland)
2275 //{ 2276 // m_log.Info("[AGENT]: landCommand");
2276 // StopFlying(); 2277 //if (colliding)
2277 // m_log.Info("[AGENT]: Stop FLying"); 2278 // m_log.Info("[AGENT]: colliding");
2278 //} 2279 //if (m_physicsActor.Flying && colliding && controlland)
2279 } 2280 //{
2280 else 2281 // StopFlying();
2281 { 2282 // m_log.Info("[AGENT]: Stop FLying");
2282 if (!m_physicsActor.Flying && m_physicsActor.IsColliding) 2283 //}
2284 }
2285 else if (!actor.Flying && actor.IsColliding)
2283 { 2286 {
2284 if (direc.Z > 2.0f) 2287 if (direc.Z > 2.0f)
2285 { 2288 {
2286 direc.Z *= 3; 2289 direc.Z *= 3.0f;
2287 2290
2288 // TODO: PreJump and jump happen too quickly. Many times prejump gets ignored. 2291 // TODO: PreJump and jump happen too quickly. Many times prejump gets ignored.
2289 TrySetMovementAnimation("PREJUMP"); 2292 TrySetMovementAnimation("PREJUMP");
@@ -2307,7 +2310,7 @@ namespace OpenSim.Region.Framework.Scenes
2307 const float ROTATION_TOLERANCE = 0.01f; 2310 const float ROTATION_TOLERANCE = 0.01f;
2308 const float VELOCITY_TOLERANCE = 0.001f; 2311 const float VELOCITY_TOLERANCE = 0.001f;
2309 const float POSITION_TOLERANCE = 0.05f; 2312 const float POSITION_TOLERANCE = 0.05f;
2310 const int TIME_MS_TOLERANCE = 3000; 2313 //const int TIME_MS_TOLERANCE = 3000;
2311 2314
2312 SendPrimUpdates(); 2315 SendPrimUpdates();
2313 2316
@@ -2320,21 +2323,24 @@ namespace OpenSim.Region.Framework.Scenes
2320 if (m_isChildAgent == false) 2323 if (m_isChildAgent == false)
2321 { 2324 {
2322 PhysicsActor actor = m_physicsActor; 2325 PhysicsActor actor = m_physicsActor;
2323 Vector3 velocity = (actor != null) ? actor.Velocity : Vector3.Zero; 2326
2327 // NOTE: Velocity is not the same as m_velocity. Velocity will attempt to
2328 // grab the latest PhysicsActor velocity, whereas m_velocity is often
2329 // storing a requested force instead of an actual traveling velocity
2324 2330
2325 // Throw away duplicate or insignificant updates 2331 // Throw away duplicate or insignificant updates
2326 if (!m_bodyRot.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) || 2332 if (!m_bodyRot.ApproxEquals(m_lastRotation, ROTATION_TOLERANCE) ||
2327 !velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) || 2333 !Velocity.ApproxEquals(m_lastVelocity, VELOCITY_TOLERANCE) ||
2328 !m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) || 2334 !m_pos.ApproxEquals(m_lastPosition, POSITION_TOLERANCE))
2329 Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) 2335 //Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE)
2330 { 2336 {
2331 SendTerseUpdateToAllClients(); 2337 SendTerseUpdateToAllClients();
2332 2338
2333 // Update the "last" values 2339 // Update the "last" values
2334 m_lastPosition = m_pos; 2340 m_lastPosition = m_pos;
2335 m_lastRotation = m_bodyRot; 2341 m_lastRotation = m_bodyRot;
2336 m_lastVelocity = velocity; 2342 m_lastVelocity = Velocity;
2337 m_lastTerseSent = Environment.TickCount; 2343 //m_lastTerseSent = Environment.TickCount;
2338 } 2344 }
2339 2345
2340 // followed suggestion from mic bowman. reversed the two lines below. 2346 // followed suggestion from mic bowman. reversed the two lines below.