aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs103
1 files changed, 56 insertions, 47 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 21c9402..3c97852 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -149,9 +149,9 @@ namespace OpenSim.Region.Framework.Scenes
149 } 149 }
150 private bool m_wasFlying; // add for fly velocity control 150 private bool m_wasFlying; // add for fly velocity control
151 151
152 private int m_lastColCount = -1; //KF: Look for Collision chnages 152// private int m_lastColCount = -1; //KF: Look for Collision chnages
153 private int m_updateCount = 0; //KF: Update Anims for a while 153// private int m_updateCount = 0; //KF: Update Anims for a while
154 private static readonly int UPDATE_COUNT = 10; // how many frames to update for 154// private static readonly int UPDATE_COUNT = 10; // how many frames to update for
155 private List<uint> m_lastColliders = new List<uint>(); 155 private List<uint> m_lastColliders = new List<uint>();
156 156
157 private TeleportFlags m_teleportFlags; 157 private TeleportFlags m_teleportFlags;
@@ -794,9 +794,6 @@ namespace OpenSim.Region.Framework.Scenes
794 794
795 AdjustKnownSeeds(); 795 AdjustKnownSeeds();
796 796
797 // TODO: I think, this won't send anything, as we are still a child here...
798 Animator.TrySetMovementAnimation("STAND");
799
800 // we created a new ScenePresence (a new child agent) in a fresh region. 797 // we created a new ScenePresence (a new child agent) in a fresh region.
801 // Request info about all the (root) agents in this region 798 // Request info about all the (root) agents in this region
802 // Note: This won't send data *to* other clients in that region (children don't send) 799 // Note: This won't send data *to* other clients in that region (children don't send)
@@ -1012,13 +1009,17 @@ namespace OpenSim.Region.Framework.Scenes
1012 1009
1013 /// <summary> 1010 /// <summary>
1014 /// This turns a root agent into a child agent 1011 /// This turns a root agent into a child agent
1012 /// </summary>
1013 /// <remarks>
1015 /// when an agent departs this region for a neighbor, this gets called. 1014 /// when an agent departs this region for a neighbor, this gets called.
1016 /// 1015 ///
1017 /// It doesn't get called for a teleport. Reason being, an agent that 1016 /// It doesn't get called for a teleport. Reason being, an agent that
1018 /// teleports out may not end up anywhere near this region 1017 /// teleports out may not end up anywhere near this region
1019 /// </summary> 1018 /// </remarks>
1020 public void MakeChildAgent() 1019 public void MakeChildAgent()
1021 { 1020 {
1021 m_log.DebugFormat("[SCENE PRESENCE]: Making {0} a child agent in {1}", Name, Scene.RegionInfo.RegionName);
1022
1022 // Reset these so that teleporting in and walking out isn't seen 1023 // Reset these so that teleporting in and walking out isn't seen
1023 // as teleporting back 1024 // as teleporting back
1024 TeleportFlags = TeleportFlags.Default; 1025 TeleportFlags = TeleportFlags.Default;
@@ -1308,11 +1309,11 @@ namespace OpenSim.Region.Framework.Scenes
1308// "[SCENE PRESENCE]: In {0} received agent update from {1}", 1309// "[SCENE PRESENCE]: In {0} received agent update from {1}",
1309// Scene.RegionInfo.RegionName, remoteClient.Name); 1310// Scene.RegionInfo.RegionName, remoteClient.Name);
1310 1311
1311 //if (IsChildAgent) 1312 if (IsChildAgent)
1312 //{ 1313 {
1313 // // m_log.Debug("DEBUG: HandleAgentUpdate: child agent"); 1314 // // m_log.Debug("DEBUG: HandleAgentUpdate: child agent");
1314 // return; 1315 return;
1315 //} 1316 }
1316 1317
1317 ++m_movementUpdateCount; 1318 ++m_movementUpdateCount;
1318 if (m_movementUpdateCount < 1) 1319 if (m_movementUpdateCount < 1)
@@ -1381,14 +1382,14 @@ namespace OpenSim.Region.Framework.Scenes
1381 1382
1382 #endregion Inputs 1383 #endregion Inputs
1383 1384
1384 // Make anims work for client side autopilot 1385// // Make anims work for client side autopilot
1385 if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_AT_POS) != 0) 1386// if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_AT_POS) != 0)
1386 m_updateCount = UPDATE_COUNT; 1387// m_updateCount = UPDATE_COUNT;
1387 1388//
1388 // Make turning in place work 1389// // Make turning in place work
1389 if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_YAW_POS) != 0 || 1390// if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_YAW_POS) != 0 ||
1390 (flags & AgentManager.ControlFlags.AGENT_CONTROL_YAW_NEG) != 0) 1391// (flags & AgentManager.ControlFlags.AGENT_CONTROL_YAW_NEG) != 0)
1391 m_updateCount = UPDATE_COUNT; 1392// m_updateCount = UPDATE_COUNT;
1392 1393
1393 if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_STAND_UP) != 0) 1394 if ((flags & AgentManager.ControlFlags.AGENT_CONTROL_STAND_UP) != 0)
1394 { 1395 {
@@ -1597,8 +1598,8 @@ namespace OpenSim.Region.Framework.Scenes
1597// } 1598// }
1598// } 1599// }
1599 1600
1600 if (update_movementflag && ParentID == 0) 1601// if (update_movementflag && ParentID == 0)
1601 Animator.UpdateMovementAnimations(); 1602// Animator.UpdateMovementAnimations();
1602 } 1603 }
1603 1604
1604 m_scene.EventManager.TriggerOnClientMovement(this); 1605 m_scene.EventManager.TriggerOnClientMovement(this);
@@ -2315,13 +2316,8 @@ namespace OpenSim.Region.Framework.Scenes
2315 2316
2316 public void HandleAgentSitOnGround() 2317 public void HandleAgentSitOnGround()
2317 { 2318 {
2318 m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick. 2319// m_updateCount = 0; // Kill animation update burst so that the SIT_G.. will stick.
2319 Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED"); 2320 Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED");
2320
2321 // TODO: This doesn't prevent the user from walking yet.
2322 // Setting parent ID would fix this, if we knew what value
2323 // to use. Or we could add a m_isSitting variable.
2324 //Animator.TrySetMovementAnimation("SIT_GROUND_CONSTRAINED");
2325 SitGround = true; 2321 SitGround = true;
2326 RemoveFromPhysicalScene(); 2322 RemoveFromPhysicalScene();
2327 } 2323 }
@@ -2933,9 +2929,12 @@ namespace OpenSim.Region.Framework.Scenes
2933 2929
2934 public void Reset() 2930 public void Reset()
2935 { 2931 {
2932// m_log.DebugFormat("[SCENE PRESENCE]: Resetting {0} in {1}", Name, Scene.RegionInfo.RegionName);
2933
2936 // Put the child agent back at the center 2934 // Put the child agent back at the center
2937 AbsolutePosition 2935 AbsolutePosition
2938 = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f), 70); 2936 = new Vector3(((float)Constants.RegionSize * 0.5f), ((float)Constants.RegionSize * 0.5f), 70);
2937
2939 Animator.ResetAnimations(); 2938 Animator.ResetAnimations();
2940 } 2939 }
2941 2940
@@ -3158,7 +3157,7 @@ namespace OpenSim.Region.Framework.Scenes
3158 } 3157 }
3159 } 3158 }
3160 3159
3161 public void CopyFrom(AgentData cAgent) 3160 private void CopyFrom(AgentData cAgent)
3162 { 3161 {
3163 m_originRegionID = cAgent.RegionID; 3162 m_originRegionID = cAgent.RegionID;
3164 3163
@@ -3217,13 +3216,10 @@ namespace OpenSim.Region.Framework.Scenes
3217 } 3216 }
3218 } 3217 }
3219 catch { } 3218 catch { }
3220 // Animations 3219
3221 try 3220 // FIXME: Why is this null check necessary? Where are the cases where we get a null Anims object?
3222 { 3221 if (cAgent.Anims != null)
3223 Animator.ResetAnimations();
3224 Animator.Animations.FromArray(cAgent.Anims); 3222 Animator.Animations.FromArray(cAgent.Anims);
3225 }
3226 catch { }
3227 3223
3228 if (cAgent.AttachmentObjects != null && cAgent.AttachmentObjects.Count > 0) 3224 if (cAgent.AttachmentObjects != null && cAgent.AttachmentObjects.Count > 0)
3229 { 3225 {
@@ -3305,19 +3301,32 @@ namespace OpenSim.Region.Framework.Scenes
3305 ControllingClient.SendAgentAlertMessage("Physics is having a problem with your avatar. You may not be able to move until you relog.", true); 3301 ControllingClient.SendAgentAlertMessage("Physics is having a problem with your avatar. You may not be able to move until you relog.", true);
3306 } 3302 }
3307 3303
3308 // Event called by the physics plugin to tell the avatar about a collision. 3304 /// <summary>
3309 private void PhysicsCollisionUpdate(EventArgs e) 3305 /// Event called by the physics plugin to tell the avatar about a collision.
3306 /// </summary>
3307 /// <remarks>
3308 /// This function is called continuously, even when there are no collisions. If the avatar is walking on the
3309 /// ground or a prim then there will be collision information between the avatar and the surface.
3310 ///
3311 /// FIXME: However, we can't safely avoid calling this yet where there are no collisions without analyzing whether
3312 /// any part of this method is relying on an every-frame call.
3313 /// </remarks>
3314 /// <param name="e"></param>
3315 public void PhysicsCollisionUpdate(EventArgs e)
3310 { 3316 {
3317 if (IsChildAgent)
3318 return;
3319
3311 //if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f)) 3320 //if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f))
3312 // The Physics Scene will send updates every 500 ms grep: PhysicsActor.SubscribeEvents( 3321 // The Physics Scene will send updates every 500 ms grep: PhysicsActor.SubscribeEvents(
3313 // as of this comment the interval is set in AddToPhysicalScene 3322 // as of this comment the interval is set in AddToPhysicalScene
3314 if (Animator != null) 3323 if (Animator != null)
3315 { 3324 {
3316 if (m_updateCount > 0) 3325// if (m_updateCount > 0)
3317 { 3326// {
3318 Animator.UpdateMovementAnimations(); 3327 Animator.UpdateMovementAnimations();
3319 m_updateCount--; 3328// m_updateCount--;
3320 } 3329// }
3321 } 3330 }
3322 3331
3323 CollisionEventUpdate collisionData = (CollisionEventUpdate)e; 3332 CollisionEventUpdate collisionData = (CollisionEventUpdate)e;
@@ -3325,13 +3334,13 @@ namespace OpenSim.Region.Framework.Scenes
3325 3334
3326 CollisionPlane = Vector4.UnitW; 3335 CollisionPlane = Vector4.UnitW;
3327 3336
3328 // No collisions at all means we may be flying. Update always 3337// // No collisions at all means we may be flying. Update always
3329 // to make falling work 3338// // to make falling work
3330 if (m_lastColCount != coldata.Count || coldata.Count == 0) 3339// if (m_lastColCount != coldata.Count || coldata.Count == 0)
3331 { 3340// {
3332 m_updateCount = UPDATE_COUNT; 3341// m_updateCount = UPDATE_COUNT;
3333 m_lastColCount = coldata.Count; 3342// m_lastColCount = coldata.Count;
3334 } 3343// }
3335 3344
3336 if (coldata.Count != 0 && Animator != null) 3345 if (coldata.Count != 0 && Animator != null)
3337 { 3346 {