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.cs90
1 files changed, 49 insertions, 41 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 4034621..5177273 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -142,12 +142,27 @@ namespace OpenSim.Region.Framework.Scenes
142 { 142 {
143 get { return m_userFlags; } 143 get { return m_userFlags; }
144 } 144 }
145 private bool m_flyingOld; // add for fly velocity control 145
146 // Flying
147 public bool Flying
148 {
149 get { return PhysicsActor != null && PhysicsActor.Flying; }
150 set { PhysicsActor.Flying = value; }
151 }
152
153 // add for fly velocity control
154 private bool FlyingOld {get; set;}
146 public bool WasFlying 155 public bool WasFlying
147 { 156 {
148 get { return m_wasFlying; } 157 get; private set;
158 }
159
160 public bool IsColliding
161 {
162 get { return PhysicsActor != null && PhysicsActor.IsColliding; }
163 // We would expect setting IsColliding to be private but it's used by a hack in Scene
164 set { PhysicsActor.IsColliding = value; }
149 } 165 }
150 private bool m_wasFlying; // add for fly velocity control
151 166
152// private int m_lastColCount = -1; //KF: Look for Collision chnages 167// private int m_lastColCount = -1; //KF: Look for Collision chnages
153// private int m_updateCount = 0; //KF: Update Anims for a while 168// private int m_updateCount = 0; //KF: Update Anims for a while
@@ -697,9 +712,9 @@ namespace OpenSim.Region.Framework.Scenes
697 set { 712 set {
698 if(value) 713 if(value)
699 { 714 {
700 if ((PhysicsActor != null) && PhysicsActor.Flying) 715 if (Flying)
701 m_AgentControlFlags |= AgentManager.ControlFlags.AGENT_CONTROL_FLY; 716 m_AgentControlFlags |= AgentManager.ControlFlags.AGENT_CONTROL_FLY;
702 else if ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0) 717 else
703 m_AgentControlFlags &= ~AgentManager.ControlFlags.AGENT_CONTROL_FLY; 718 m_AgentControlFlags &= ~AgentManager.ControlFlags.AGENT_CONTROL_FLY;
704 } 719 }
705 m_inTransit = value; 720 m_inTransit = value;
@@ -925,11 +940,11 @@ namespace OpenSim.Region.Framework.Scenes
925 940
926 if (ForceFly) 941 if (ForceFly)
927 { 942 {
928 PhysicsActor.Flying = true; 943 Flying = true;
929 } 944 }
930 else if (FlyDisabled) 945 else if (FlyDisabled)
931 { 946 {
932 PhysicsActor.Flying = false; 947 Flying = false;
933 } 948 }
934 949
935 // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying 950 // Don't send an animation pack here, since on a region crossing this will sometimes cause a flying
@@ -1054,11 +1069,7 @@ namespace OpenSim.Region.Framework.Scenes
1054 /// <param name="pos"></param> 1069 /// <param name="pos"></param>
1055 public void Teleport(Vector3 pos) 1070 public void Teleport(Vector3 pos)
1056 { 1071 {
1057 bool isFlying = false; 1072 bool isFlying = Flying;
1058 if (PhysicsActor != null)
1059 isFlying = PhysicsActor.Flying;
1060
1061 m_log.DebugFormat("[SCENE PRESENCCE]: Local teleport, flying = {0}", isFlying);
1062 RemoveFromPhysicalScene(); 1073 RemoveFromPhysicalScene();
1063 Velocity = Vector3.Zero; 1074 Velocity = Vector3.Zero;
1064 CheckLandingPoint(ref pos); 1075 CheckLandingPoint(ref pos);
@@ -1070,10 +1081,7 @@ namespace OpenSim.Region.Framework.Scenes
1070 1081
1071 public void TeleportWithMomentum(Vector3 pos) 1082 public void TeleportWithMomentum(Vector3 pos)
1072 { 1083 {
1073 bool isFlying = false; 1084 bool isFlying = Flying;
1074 if (PhysicsActor != null)
1075 isFlying = PhysicsActor.Flying;
1076
1077 RemoveFromPhysicalScene(); 1085 RemoveFromPhysicalScene();
1078 CheckLandingPoint(ref pos); 1086 CheckLandingPoint(ref pos);
1079 AbsolutePosition = pos; 1087 AbsolutePosition = pos;
@@ -1208,8 +1216,8 @@ namespace OpenSim.Region.Framework.Scenes
1208 AbsolutePosition = pos; 1216 AbsolutePosition = pos;
1209 } 1217 }
1210 1218
1211 bool m_flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); 1219 bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
1212 MakeRootAgent(AbsolutePosition, m_flying); 1220 MakeRootAgent(AbsolutePosition, flying);
1213 1221
1214 if ((m_callbackURI != null) && !m_callbackURI.Equals("")) 1222 if ((m_callbackURI != null) && !m_callbackURI.Equals(""))
1215 { 1223 {
@@ -1434,7 +1442,7 @@ namespace OpenSim.Region.Framework.Scenes
1434 bool DCFlagKeyPressed = false; 1442 bool DCFlagKeyPressed = false;
1435 Vector3 agent_control_v3 = Vector3.Zero; 1443 Vector3 agent_control_v3 = Vector3.Zero;
1436 1444
1437 bool oldflying = PhysicsActor.Flying; 1445 bool oldflying = Flying;
1438 1446
1439 if (ForceFly) 1447 if (ForceFly)
1440 actor.Flying = true; 1448 actor.Flying = true;
@@ -1454,7 +1462,7 @@ namespace OpenSim.Region.Framework.Scenes
1454 1462
1455 // use camera up angle when in mouselook and not flying or when holding the left mouse button down and not flying 1463 // use camera up angle when in mouselook and not flying or when holding the left mouse button down and not flying
1456 // this prevents 'jumping' in inappropriate situations. 1464 // this prevents 'jumping' in inappropriate situations.
1457 if ((m_mouseLook && !PhysicsActor.Flying) || (m_leftButtonDown && !PhysicsActor.Flying)) 1465 if (!Flying && (m_mouseLook || m_leftButtonDown))
1458 dirVectors = GetWalkDirectionVectors(); 1466 dirVectors = GetWalkDirectionVectors();
1459 else 1467 else
1460 dirVectors = Dir_Vectors; 1468 dirVectors = Dir_Vectors;
@@ -1541,7 +1549,7 @@ namespace OpenSim.Region.Framework.Scenes
1541 // with something with the down arrow pressed. 1549 // with something with the down arrow pressed.
1542 1550
1543 // Only do this if we're flying 1551 // Only do this if we're flying
1544 if (PhysicsActor != null && PhysicsActor.Flying && !ForceFly) 1552 if (Flying && !ForceFly)
1545 { 1553 {
1546 // Landing detection code 1554 // Landing detection code
1547 1555
@@ -1549,7 +1557,7 @@ namespace OpenSim.Region.Framework.Scenes
1549 bool controlland = (((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || 1557 bool controlland = (((flags & AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) ||
1550 ((flags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)); 1558 ((flags & AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0));
1551 1559
1552 if (PhysicsActor.Flying && PhysicsActor.IsColliding && controlland) 1560 if (Flying && IsColliding && controlland)
1553 { 1561 {
1554 // nesting this check because LengthSquared() is expensive and we don't 1562 // nesting this check because LengthSquared() is expensive and we don't
1555 // want to do it every step when flying. 1563 // want to do it every step when flying.
@@ -1762,9 +1770,9 @@ namespace OpenSim.Region.Framework.Scenes
1762 Name, pos, terrainHeight, m_scene.RegionInfo.RegionName); 1770 Name, pos, terrainHeight, m_scene.RegionInfo.RegionName);
1763 1771
1764 if (noFly) 1772 if (noFly)
1765 PhysicsActor.Flying = false; 1773 Flying = false;
1766 else if (pos.Z > terrainHeight) 1774 else if (pos.Z > terrainHeight)
1767 PhysicsActor.Flying = true; 1775 Flying = true;
1768 1776
1769 LandAtTarget = landAtTarget; 1777 LandAtTarget = landAtTarget;
1770 MovingToTarget = true; 1778 MovingToTarget = true;
@@ -2330,42 +2338,42 @@ namespace OpenSim.Region.Framework.Scenes
2330 Vector3 direc = vec * Rotation; 2338 Vector3 direc = vec * Rotation;
2331 direc.Normalize(); 2339 direc.Normalize();
2332 2340
2333 if (PhysicsActor.Flying != m_flyingOld) // add for fly velocity control 2341 if (Flying != FlyingOld) // add for fly velocity control
2334 { 2342 {
2335 m_flyingOld = PhysicsActor.Flying; // add for fly velocity control 2343 FlyingOld = Flying; // add for fly velocity control
2336 if (!PhysicsActor.Flying) 2344 if (!Flying)
2337 m_wasFlying = true; // add for fly velocity control 2345 WasFlying = true; // add for fly velocity control
2338 } 2346 }
2339 2347
2340 if (PhysicsActor.IsColliding == true) 2348 if (IsColliding)
2341 m_wasFlying = false; // add for fly velocity control 2349 WasFlying = false; // add for fly velocity control
2342 2350
2343 if ((vec.Z == 0f) && !PhysicsActor.Flying) 2351 if ((vec.Z == 0f) && !Flying)
2344 direc.Z = 0f; // Prevent camera WASD up. 2352 direc.Z = 0f; // Prevent camera WASD up.
2345 2353
2346 direc *= 0.03f * 128f * SpeedModifier; 2354 direc *= 0.03f * 128f * SpeedModifier;
2347 2355
2348 if (PhysicsActor != null) 2356 if (PhysicsActor != null)
2349 { 2357 {
2350 if (PhysicsActor.Flying) 2358 if (Flying)
2351 { 2359 {
2352 direc *= 4.0f; 2360 direc *= 4.0f;
2353 //bool controlland = (((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0)); 2361 //bool controlland = (((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0));
2354 //if (controlland) 2362 //if (controlland)
2355 // m_log.Info("[AGENT]: landCommand"); 2363 // m_log.Info("[AGENT]: landCommand");
2356 //if (PhysicsActor.IsColliding) 2364 //if (IsColliding)
2357 // m_log.Info("[AGENT]: colliding"); 2365 // m_log.Info("[AGENT]: colliding");
2358 //if (PhysicsActor.Flying && PhysicsActor.IsColliding && controlland) 2366 //if (Flying && IsColliding && controlland)
2359 //{ 2367 //{
2360 // StopFlying(); 2368 // StopFlying();
2361 // m_log.Info("[AGENT]: Stop Flying"); 2369 // m_log.Info("[AGENT]: Stop Flying");
2362 //} 2370 //}
2363 } 2371 }
2364 if (Animator.Falling && m_wasFlying) // if falling from flying, disable motion add 2372 if (Animator.Falling && WasFlying) // if falling from flying, disable motion add
2365 { 2373 {
2366 direc *= 0.0f; 2374 direc *= 0.0f;
2367 } 2375 }
2368 else if (!PhysicsActor.Flying && PhysicsActor.IsColliding) 2376 else if (!Flying && IsColliding)
2369 { 2377 {
2370 if (direc.Z > 2.0f) 2378 if (direc.Z > 2.0f)
2371 { 2379 {
@@ -2835,7 +2843,7 @@ namespace OpenSim.Region.Framework.Scenes
2835 { 2843 {
2836 if (m_requestedSitTargetUUID == UUID.Zero) 2844 if (m_requestedSitTargetUUID == UUID.Zero)
2837 { 2845 {
2838 bool isFlying = PhysicsActor.Flying; 2846 bool isFlying = Flying;
2839 RemoveFromPhysicalScene(); 2847 RemoveFromPhysicalScene();
2840 2848
2841 Vector3 pos = AbsolutePosition; 2849 Vector3 pos = AbsolutePosition;
@@ -2862,7 +2870,7 @@ namespace OpenSim.Region.Framework.Scenes
2862 { 2870 {
2863 if (m_requestedSitTargetUUID == UUID.Zero) 2871 if (m_requestedSitTargetUUID == UUID.Zero)
2864 { 2872 {
2865 bool isFlying = PhysicsActor.Flying; 2873 bool isFlying = Flying;
2866 RemoveFromPhysicalScene(); 2874 RemoveFromPhysicalScene();
2867 2875
2868 Vector3 pos = AbsolutePosition; 2876 Vector3 pos = AbsolutePosition;
@@ -2912,7 +2920,7 @@ namespace OpenSim.Region.Framework.Scenes
2912 { 2920 {
2913 try 2921 try
2914 { 2922 {
2915 return m_scene.CrossAgentToNewRegion(this, PhysicsActor.Flying); 2923 return m_scene.CrossAgentToNewRegion(this, Flying);
2916 } 2924 }
2917 catch 2925 catch
2918 { 2926 {
@@ -3188,7 +3196,7 @@ namespace OpenSim.Region.Framework.Scenes
3188 Appearance = new AvatarAppearance(cAgent.Appearance); 3196 Appearance = new AvatarAppearance(cAgent.Appearance);
3189 if (PhysicsActor != null) 3197 if (PhysicsActor != null)
3190 { 3198 {
3191 bool isFlying = PhysicsActor.Flying; 3199 bool isFlying = Flying;
3192 RemoveFromPhysicalScene(); 3200 RemoveFromPhysicalScene();
3193 AddToPhysicalScene(isFlying); 3201 AddToPhysicalScene(isFlying);
3194 } 3202 }
@@ -3291,7 +3299,7 @@ namespace OpenSim.Region.Framework.Scenes
3291 3299
3292 private void OutOfBoundsCall(Vector3 pos) 3300 private void OutOfBoundsCall(Vector3 pos)
3293 { 3301 {
3294 //bool flying = PhysicsActor.Flying; 3302 //bool flying = Flying;
3295 //RemoveFromPhysicalScene(); 3303 //RemoveFromPhysicalScene();
3296 3304
3297 //AddToPhysicalScene(flying); 3305 //AddToPhysicalScene(flying);