aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs53
1 files changed, 51 insertions, 2 deletions
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index e30c564..5874aab 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -85,6 +85,9 @@ namespace OpenSim.Region.Environment.Scenes
85 protected Vector3 m_CameraAtAxis = new Vector3(0, 0, 0); 85 protected Vector3 m_CameraAtAxis = new Vector3(0, 0, 0);
86 protected Vector3 m_CameraLeftAxis = new Vector3(0, 0, 0); 86 protected Vector3 m_CameraLeftAxis = new Vector3(0, 0, 0);
87 protected Vector3 m_CameraUpAxis = new Vector3(0, 0, 0); 87 protected Vector3 m_CameraUpAxis = new Vector3(0, 0, 0);
88 private uint m_AgentControlFlags = (uint)0;
89 private LLQuaternion m_headrotation = new LLQuaternion();
90 private byte m_state = (byte)0;
88 91
89 // Agent's Draw distance. 92 // Agent's Draw distance.
90 protected float m_DrawDistance = 0f; 93 protected float m_DrawDistance = 0f;
@@ -104,7 +107,8 @@ namespace OpenSim.Region.Environment.Scenes
104 DIR_CONTROL_FLAG_LEFT = AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS, 107 DIR_CONTROL_FLAG_LEFT = AgentManager.ControlFlags.AGENT_CONTROL_LEFT_POS,
105 DIR_CONTROL_FLAG_RIGHT = AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG, 108 DIR_CONTROL_FLAG_RIGHT = AgentManager.ControlFlags.AGENT_CONTROL_LEFT_NEG,
106 DIR_CONTROL_FLAG_UP = AgentManager.ControlFlags.AGENT_CONTROL_UP_POS, 109 DIR_CONTROL_FLAG_UP = AgentManager.ControlFlags.AGENT_CONTROL_UP_POS,
107 DIR_CONTROL_FLAG_DOWN = AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG 110 DIR_CONTROL_FLAG_DOWN = AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG,
111 DIR_CONTROL_FLAG_DOWN_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG
108 } 112 }
109 113
110 /// <summary> 114 /// <summary>
@@ -360,6 +364,7 @@ namespace OpenSim.Region.Environment.Scenes
360 Dir_Vectors[3] = new Vector3(0, -1, 0); //RIGHT 364 Dir_Vectors[3] = new Vector3(0, -1, 0); //RIGHT
361 Dir_Vectors[4] = new Vector3(0, 0, 1); //UP 365 Dir_Vectors[4] = new Vector3(0, 0, 1); //UP
362 Dir_Vectors[5] = new Vector3(0, 0, -1); //DOWN 366 Dir_Vectors[5] = new Vector3(0, 0, -1); //DOWN
367 Dir_Vectors[5] = new Vector3(0, 0, -0.5f); //DOWN_Nudge
363 } 368 }
364 #endregion 369 #endregion
365 370
@@ -526,6 +531,12 @@ namespace OpenSim.Region.Environment.Scenes
526 public void StopMovement() 531 public void StopMovement()
527 { 532 {
528 } 533 }
534 public void StopFlying()
535 {
536 MainLog.Instance.Verbose("AGENT","VEL:" + Velocity.ToString());
537 AbsolutePosition = AbsolutePosition + new LLVector3(0, 0, (m_avHeight/2));
538 SendFullUpdateToAllClients();
539 }
529 540
530 public void AddNeighbourRegion(ulong regionHandle) 541 public void AddNeighbourRegion(ulong regionHandle)
531 { 542 {
@@ -637,6 +648,12 @@ namespace OpenSim.Region.Environment.Scenes
637 // m_parentID = (what should this be?) 648 // m_parentID = (what should this be?)
638 SetMovementAnimation(Animations.AnimsLLUUID["SIT_GROUND"], 1); 649 SetMovementAnimation(Animations.AnimsLLUUID["SIT_GROUND"], 1);
639 } 650 }
651 // In the future, these values might need to go global.
652 // Here's where you get them.
653
654 // m_AgentControlFlags = flags;
655 // m_headrotation = agentData.AgentData.HeadRotation;
656 // m_state = agentData.AgentData.State;
640 657
641 if (m_allowMovement) 658 if (m_allowMovement)
642 { 659 {
@@ -685,7 +702,27 @@ namespace OpenSim.Region.Environment.Scenes
685 i++; 702 i++;
686 } 703 }
687 } 704 }
705 // Cause the avatar to stop flying if it's colliding
706 // with something with the down arrow pressed.
707
708 // Skip if there's no physicsactor
709 if (m_physicsActor != null)
710 {
711 // Only do this if we're flying
712 if (m_physicsActor.Flying)
713 {
714 // Are the landing controls requirements filled?
715 bool controlland = (((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || ((flags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0));
716
717 // Are the collision requirements fulfilled?
718 bool colliding = (m_physicsActor.IsColliding == true);
688 719
720 if (m_physicsActor.Flying && colliding && controlland)
721 {
722 StopFlying();
723 }
724 }
725 }
689 if ((update_movementflag) || (update_rotation && DCFlagKeyPressed)) 726 if ((update_movementflag) || (update_rotation && DCFlagKeyPressed))
690 { 727 {
691 AddNewMovement(agent_control_v3, q); 728 AddNewMovement(agent_control_v3, q);
@@ -947,7 +984,7 @@ namespace OpenSim.Region.Environment.Scenes
947 Console.WriteLine("DEBUG: AddNewMovement: child agent"); 984 Console.WriteLine("DEBUG: AddNewMovement: child agent");
948 return; 985 return;
949 } 986 }
950 987 m_rotation = rotation;
951 NewForce newVelocity = new NewForce(); 988 NewForce newVelocity = new NewForce();
952 Vector3 direc = rotation * vec; 989 Vector3 direc = rotation * vec;
953 direc.Normalize(); 990 direc.Normalize();
@@ -956,6 +993,17 @@ namespace OpenSim.Region.Environment.Scenes
956 if (m_physicsActor.Flying) 993 if (m_physicsActor.Flying)
957 { 994 {
958 direc *= 4; 995 direc *= 4;
996 bool controlland = (((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG) != 0) || ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG) != 0));
997 bool colliding = (m_physicsActor.IsColliding==true);
998 if (controlland)
999 MainLog.Instance.Verbose("AGENT","landCommand");
1000 if (colliding )
1001 MainLog.Instance.Verbose("AGENT","colliding");
1002 if (m_physicsActor.Flying && colliding && controlland)
1003 {
1004 StopFlying();
1005 MainLog.Instance.Verbose("AGENT", "Stop FLying");
1006 }
959 } 1007 }
960 else 1008 else
961 { 1009 {
@@ -971,6 +1019,7 @@ namespace OpenSim.Region.Environment.Scenes
971 SetMovementAnimation(Animations.AnimsLLUUID["JUMP"], 1); 1019 SetMovementAnimation(Animations.AnimsLLUUID["JUMP"], 1);
972 } 1020 }
973 } 1021 }
1022
974 } 1023 }
975 1024
976 newVelocity.X = direc.x; 1025 newVelocity.X = direc.x;