aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs120
1 files changed, 49 insertions, 71 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 19e6a20..a1fc1c0 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -146,6 +146,11 @@ namespace OpenSim.Region.Framework.Scenes
146 private bool m_flyingOld; // add for fly velocity control 146 private bool m_flyingOld; // add for fly velocity control
147 public bool m_wasFlying; // add for fly velocity control 147 public bool m_wasFlying; // add for fly velocity control
148 148
149 private int m_lastColCount = -1; //KF: Look for Collision chnages
150 private int m_updateCount = 0; //KF: Update Anims for a while
151 private static readonly int UPDATE_COUNT = 10; // how many frames to update for
152 private List<uint> m_lastColliders = new List<uint>();
153
149 private TeleportFlags m_teleportFlags; 154 private TeleportFlags m_teleportFlags;
150 public TeleportFlags TeleportFlags 155 public TeleportFlags TeleportFlags
151 { 156 {
@@ -208,13 +213,7 @@ namespace OpenSim.Region.Framework.Scenes
208 private bool m_followCamAuto; 213 private bool m_followCamAuto;
209 214
210 private int m_movementUpdateCount; 215 private int m_movementUpdateCount;
211 private int m_lastColCount = -1; //KF: Look for Collision chnages
212 private int m_updateCount = 0; //KF: Update Anims for a while
213 private static readonly int UPDATE_COUNT = 10; // how many frames to update for
214 private const int NumMovementsBetweenRayCast = 5; 216 private const int NumMovementsBetweenRayCast = 5;
215 private List<uint> m_lastColliders = new List<uint>();
216
217 private object m_syncRoot = new Object();
218 217
219 private bool CameraConstraintActive; 218 private bool CameraConstraintActive;
220 //private int m_moveToPositionStateStatus; 219 //private int m_moveToPositionStateStatus;
@@ -255,7 +254,7 @@ namespace OpenSim.Region.Framework.Scenes
255 DIR_CONTROL_FLAG_UP = AgentManager.ControlFlags.AGENT_CONTROL_UP_POS, 254 DIR_CONTROL_FLAG_UP = AgentManager.ControlFlags.AGENT_CONTROL_UP_POS,
256 DIR_CONTROL_FLAG_DOWN = AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG, 255 DIR_CONTROL_FLAG_DOWN = AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG,
257 DIR_CONTROL_FLAG_FORWARD_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS, 256 DIR_CONTROL_FLAG_FORWARD_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS,
258 DIR_CONTROL_FLAG_BACK_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG, 257 DIR_CONTROL_FLAG_BACKWARD_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG,
259 DIR_CONTROL_FLAG_LEFT_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_POS, 258 DIR_CONTROL_FLAG_LEFT_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_POS,
260 DIR_CONTROL_FLAG_RIGHT_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_NEG, 259 DIR_CONTROL_FLAG_RIGHT_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_NEG,
261 DIR_CONTROL_FLAG_DOWN_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG 260 DIR_CONTROL_FLAG_DOWN_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG
@@ -496,11 +495,9 @@ namespace OpenSim.Region.Framework.Scenes
496 { 495 {
497 get 496 get
498 { 497 {
499 PhysicsActor actor = m_physicsActor; 498 if (PhysicsActor != null && m_parentID == 0)
500// if (actor != null) 499 {
501 if ((actor != null) && (m_parentID == 0)) // KF Do NOT update m_pos here if Av is sitting! 500 m_pos = PhysicsActor.Position;
502 {
503 m_pos = actor.Position;
504 501
505// m_log.DebugFormat( 502// m_log.DebugFormat(
506// "[SCENE PRESENCE]: Set position {0} for {1} in {2} via getting AbsolutePosition!", 503// "[SCENE PRESENCE]: Set position {0} for {1} in {2} via getting AbsolutePosition!",
@@ -551,10 +548,8 @@ namespace OpenSim.Region.Framework.Scenes
551 } 548 }
552 } 549 }
553 550
554// Changed this to update unconditionally to make npose work 551 m_pos = value;
555// if (m_parentID == 0) // KF Do NOT update m_pos here if Av is sitting! 552 ParentPosition = Vector3.Zero;
556 m_pos = value;
557 m_parentPosition = Vector3.Zero;
558 553
559// m_log.DebugFormat( 554// m_log.DebugFormat(
560// "[ENTITY BASE]: In {0} set AbsolutePosition of {1} to {2}", 555// "[ENTITY BASE]: In {0} set AbsolutePosition of {1} to {2}",
@@ -637,15 +632,12 @@ namespace OpenSim.Region.Framework.Scenes
637 set { m_isChildAgent = value; } 632 set { m_isChildAgent = value; }
638 } 633 }
639 634
640 private uint m_parentID;
641
642
643 public uint ParentID 635 public uint ParentID
644 { 636 {
645 get { return m_parentID; } 637 get { return m_parentID; }
646 set { m_parentID = value; } 638 set { m_parentID = value; }
647 } 639 }
648 640 private uint m_parentID;
649 641
650 public float Health 642 public float Health
651 { 643 {
@@ -797,7 +789,10 @@ namespace OpenSim.Region.Framework.Scenes
797 m_reprioritization_timer.AutoReset = false; 789 m_reprioritization_timer.AutoReset = false;
798 790
799 AdjustKnownSeeds(); 791 AdjustKnownSeeds();
792
793 // TODO: I think, this won't send anything, as we are still a child here...
800 Animator.TrySetMovementAnimation("STAND"); 794 Animator.TrySetMovementAnimation("STAND");
795
801 // we created a new ScenePresence (a new child agent) in a fresh region. 796 // we created a new ScenePresence (a new child agent) in a fresh region.
802 // Request info about all the (root) agents in this region 797 // Request info about all the (root) agents in this region
803 // Note: This won't send data *to* other clients in that region (children don't send) 798 // Note: This won't send data *to* other clients in that region (children don't send)
@@ -861,7 +856,7 @@ namespace OpenSim.Region.Framework.Scenes
861 vector[10] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN_NUDGE 856 vector[10] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN_NUDGE
862 return vector; 857 return vector;
863 } 858 }
864 859
865 #endregion 860 #endregion
866 861
867 public uint GenerateClientFlags(UUID ObjectID) 862 public uint GenerateClientFlags(UUID ObjectID)
@@ -876,8 +871,6 @@ namespace OpenSim.Region.Framework.Scenes
876 /// </summary> 871 /// </summary>
877 public void SendPrimUpdates() 872 public void SendPrimUpdates()
878 { 873 {
879 m_sceneViewer.SendPrimUpdates();
880
881 SceneViewer.SendPrimUpdates(); 874 SceneViewer.SendPrimUpdates();
882 } 875 }
883 876
@@ -1117,11 +1110,11 @@ namespace OpenSim.Region.Framework.Scenes
1117 { 1110 {
1118 try 1111 try
1119 { 1112 {
1120 m_physicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; 1113 PhysicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients;
1121 m_physicsActor.OnOutOfBounds -= OutOfBoundsCall; 1114 PhysicsActor.OnOutOfBounds -= OutOfBoundsCall;
1122 m_physicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate;
1123 m_scene.PhysicsScene.RemoveAvatar(PhysicsActor); 1115 m_scene.PhysicsScene.RemoveAvatar(PhysicsActor);
1124 m_physicsActor.UnSubscribeEvents(); 1116 PhysicsActor.UnSubscribeEvents();
1117 PhysicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate;
1125 PhysicsActor = null; 1118 PhysicsActor = null;
1126 } 1119 }
1127 catch 1120 catch
@@ -1146,7 +1139,6 @@ namespace OpenSim.Region.Framework.Scenes
1146 AddToPhysicalScene(isFlying); 1139 AddToPhysicalScene(isFlying);
1147 1140
1148 SendTerseUpdateToAllClients(); 1141 SendTerseUpdateToAllClients();
1149
1150 } 1142 }
1151 1143
1152 public void TeleportWithMomentum(Vector3 pos) 1144 public void TeleportWithMomentum(Vector3 pos)
@@ -1364,12 +1356,11 @@ namespace OpenSim.Region.Framework.Scenes
1364 /// <summary> 1356 /// <summary>
1365 /// This is the event handler for client movement. If a client is moving, this event is triggering. 1357 /// This is the event handler for client movement. If a client is moving, this event is triggering.
1366 /// </summary> 1358 /// </summary>
1367 /// <summary>
1368 /// This is the event handler for client movement. If a client is moving, this event is triggering.
1369 /// </summary>
1370 public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData) 1359 public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData)
1371 { 1360 {
1372 // m_log.DebugFormat("[SCENE PRESENCE]: Received agent update from {0}", remoteClient.Name); 1361// m_log.DebugFormat(
1362// "[SCENE PRESENCE]: In {0} received agent update from {1}",
1363// Scene.RegionInfo.RegionName, remoteClient.Name);
1373 1364
1374 //if (IsChildAgent) 1365 //if (IsChildAgent)
1375 //{ 1366 //{
@@ -1570,7 +1561,7 @@ namespace OpenSim.Region.Framework.Scenes
1570 1561
1571 if ((MovementFlag & (byte)(uint)DCF) == 0) 1562 if ((MovementFlag & (byte)(uint)DCF) == 0)
1572 { 1563 {
1573 if (DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACK_NUDGE) 1564 if (DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACKWARD_NUDGE)
1574 { 1565 {
1575 MovementFlag |= (byte)nudgehack; 1566 MovementFlag |= (byte)nudgehack;
1576 } 1567 }
@@ -1582,13 +1573,13 @@ namespace OpenSim.Region.Framework.Scenes
1582 } 1573 }
1583 else 1574 else
1584 { 1575 {
1585 if ((m_movementflag & (byte)(uint)DCF) != 0 || 1576 if ((MovementFlag & (byte)(uint)DCF) != 0 ||
1586 ((DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACK_NUDGE) 1577 ((DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_FORWARD_NUDGE || DCF == Dir_ControlFlags.DIR_CONTROL_FLAG_BACKWARD_NUDGE)
1587 && ((m_movementflag & (byte)nudgehack) == nudgehack)) 1578 && ((MovementFlag & (byte)nudgehack) == nudgehack))
1588 ) // This or is for Nudge forward 1579 ) // This or is for Nudge forward
1589 { 1580 {
1590 // m_log.DebugFormat("[SCENE PRESENCE]: Updating m_movementflag for {0} with lack of {1}", Name, DCF); 1581// m_log.DebugFormat("[SCENE PRESENCE]: Updating MovementFlag for {0} with lack of {1}", Name, DCF);
1591 m_movementflag -= ((byte)(uint)DCF); 1582 MovementFlag -= ((byte)(uint)DCF);
1592 update_movementflag = true; 1583 update_movementflag = true;
1593 1584
1594 /* 1585 /*
@@ -1818,9 +1809,9 @@ namespace OpenSim.Region.Framework.Scenes
1818 if (SitGround) 1809 if (SitGround)
1819 StandUp(); 1810 StandUp();
1820 1811
1821// m_log.DebugFormat( 1812 m_log.DebugFormat(
1822// "[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}", 1813 "[SCENE PRESENCE]: Avatar {0} received request to move to position {1} in {2}",
1823// Name, pos, m_scene.RegionInfo.RegionName); 1814 Name, pos, m_scene.RegionInfo.RegionName);
1824 1815
1825 if (pos.X < 0 || pos.X >= Constants.RegionSize 1816 if (pos.X < 0 || pos.X >= Constants.RegionSize
1826 || pos.Y < 0 || pos.Y >= Constants.RegionSize 1817 || pos.Y < 0 || pos.Y >= Constants.RegionSize
@@ -1846,9 +1837,9 @@ namespace OpenSim.Region.Framework.Scenes
1846 if (pos.Z - terrainHeight < 0.2) 1837 if (pos.Z - terrainHeight < 0.2)
1847 pos.Z = terrainHeight; 1838 pos.Z = terrainHeight;
1848 1839
1849// m_log.DebugFormat( 1840 m_log.DebugFormat(
1850// "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}", 1841 "[SCENE PRESENCE]: Avatar {0} set move to target {1} (terrain height {2}) in {3}",
1851// Name, pos, terrainHeight, m_scene.RegionInfo.RegionName); 1842 Name, pos, terrainHeight, m_scene.RegionInfo.RegionName);
1852 1843
1853 if (noFly) 1844 if (noFly)
1854 PhysicsActor.Flying = false; 1845 PhysicsActor.Flying = false;
@@ -1884,7 +1875,7 @@ namespace OpenSim.Region.Framework.Scenes
1884 /// </summary> 1875 /// </summary>
1885 public void ResetMoveToTarget() 1876 public void ResetMoveToTarget()
1886 { 1877 {
1887// m_log.DebugFormat("[SCENE PRESENCE]: Resetting move to target for {0}", Name); 1878 m_log.DebugFormat("[SCENE PRESENCE]: Resetting move to target for {0}", Name);
1888 1879
1889 MovingToTarget = false; 1880 MovingToTarget = false;
1890 MoveToPositionTarget = Vector3.Zero; 1881 MoveToPositionTarget = Vector3.Zero;
@@ -2548,9 +2539,6 @@ namespace OpenSim.Region.Framework.Scenes
2548 2539
2549 CheckForSignificantMovement(); // sends update to the modules. 2540 CheckForSignificantMovement(); // sends update to the modules.
2550 } 2541 }
2551
2552 //Sending prim updates AFTER the avatar terse updates are sent
2553 SendPrimUpdates();
2554 } 2542 }
2555 2543
2556 #endregion 2544 #endregion
@@ -3268,7 +3256,6 @@ namespace OpenSim.Region.Framework.Scenes
3268 m_callbackURI = cAgent.CallbackURI; 3256 m_callbackURI = cAgent.CallbackURI;
3269 3257
3270 m_pos = cAgent.Position; 3258 m_pos = cAgent.Position;
3271
3272 m_velocity = cAgent.Velocity; 3259 m_velocity = cAgent.Velocity;
3273 CameraPosition = cAgent.Center; 3260 CameraPosition = cAgent.Center;
3274 CameraAtAxis = cAgent.AtAxis; 3261 CameraAtAxis = cAgent.AtAxis;
@@ -3415,14 +3402,14 @@ namespace OpenSim.Region.Framework.Scenes
3415 //if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f)) 3402 //if ((Math.Abs(Velocity.X) > 0.1e-9f) || (Math.Abs(Velocity.Y) > 0.1e-9f))
3416 // The Physics Scene will send updates every 500 ms grep: PhysicsActor.SubscribeEvents( 3403 // The Physics Scene will send updates every 500 ms grep: PhysicsActor.SubscribeEvents(
3417 // as of this comment the interval is set in AddToPhysicalScene 3404 // as of this comment the interval is set in AddToPhysicalScene
3418 if (Animator!=null) 3405 if (Animator != null)
3419 { 3406 {
3420 if (m_updateCount > 0) //KF: DO NOT call UpdateMovementAnimations outside of the m_updateCount wrapper, 3407 if (m_updateCount > 0)
3421 { // else its will lock out other animation changes, like ground sit. 3408 {
3422 Animator.UpdateMovementAnimations(); 3409 Animator.UpdateMovementAnimations();
3423 m_updateCount--; 3410 m_updateCount--;
3424 } 3411 }
3425 } 3412 }
3426 3413
3427 CollisionEventUpdate collisionData = (CollisionEventUpdate)e; 3414 CollisionEventUpdate collisionData = (CollisionEventUpdate)e;
3428 Dictionary<uint, ContactPoint> coldata = collisionData.m_objCollisionList; 3415 Dictionary<uint, ContactPoint> coldata = collisionData.m_objCollisionList;
@@ -3431,12 +3418,12 @@ namespace OpenSim.Region.Framework.Scenes
3431 3418
3432 // No collisions at all means we may be flying. Update always 3419 // No collisions at all means we may be flying. Update always
3433 // to make falling work 3420 // to make falling work
3434 if (m_lastColCount != coldata.Count || coldata.Count == 0) 3421 if (m_lastColCount != coldata.Count || coldata.Count == 0)
3435 { 3422 {
3436 m_updateCount = UPDATE_COUNT; 3423 m_updateCount = UPDATE_COUNT;
3437 m_lastColCount = coldata.Count; 3424 m_lastColCount = coldata.Count;
3438 } 3425 }
3439 3426
3440 if (coldata.Count != 0 && Animator != null) 3427 if (coldata.Count != 0 && Animator != null)
3441 { 3428 {
3442 switch (Animator.CurrentMovementAnimation) 3429 switch (Animator.CurrentMovementAnimation)
@@ -4047,15 +4034,6 @@ namespace OpenSim.Region.Framework.Scenes
4047 } 4034 }
4048 } 4035 }
4049 4036
4050 private Vector3 Quat2Euler(Quaternion rot){
4051 float x = Utils.RAD_TO_DEG * (float)Math.Atan2((double)((2.0f * rot.X * rot.W) - (2.0f * rot.Y * rot.Z)) ,
4052 (double)(1 - (2.0f * rot.X * rot.X) - (2.0f * rot.Z * rot.Z)));
4053 float y = Utils.RAD_TO_DEG * (float)Math.Asin ((double)((2.0f * rot.X * rot.Y) + (2.0f * rot.Z * rot.W)));
4054 float z = Utils.RAD_TO_DEG * (float)Math.Atan2(((double)(2.0f * rot.Y * rot.W) - (2.0f * rot.X * rot.Z)) ,
4055 (double)(1 - (2.0f * rot.Y * rot.Y) - (2.0f * rot.Z * rot.Z)));
4056 return(new Vector3(x,y,z));
4057 }
4058
4059 private void CheckLandingPoint(ref Vector3 pos) 4037 private void CheckLandingPoint(ref Vector3 pos)
4060 { 4038 {
4061 // Never constrain lures 4039 // Never constrain lures