diff options
author | Teravus Ovares | 2007-12-26 00:57:37 +0000 |
---|---|---|
committer | Teravus Ovares | 2007-12-26 00:57:37 +0000 |
commit | e008c3e4a941eb3631976f77f38a82c7d8e04533 (patch) | |
tree | 7baa668f9f4138a489b700d467e09fa6311e5fe7 | |
parent | Small non-functional inventory changes (diff) | |
download | opensim-SC-e008c3e4a941eb3631976f77f38a82c7d8e04533.zip opensim-SC-e008c3e4a941eb3631976f77f38a82c7d8e04533.tar.gz opensim-SC-e008c3e4a941eb3631976f77f38a82c7d8e04533.tar.bz2 opensim-SC-e008c3e4a941eb3631976f77f38a82c7d8e04533.tar.xz |
* Added the ability to land automatically on prim by pressing the page down button when over them and colliding
* Reverted the avatar portion of the inter-penetration physics scene explosion management, it needs more work.
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 53 | ||||
-rw-r--r-- | OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 14 |
2 files changed, 58 insertions, 9 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; |
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index b4336c3..83190c4 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |||
@@ -296,9 +296,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
296 | if (p2.PhysicsActorType == (int)ActorTypes.Agent) | 296 | if (p2.PhysicsActorType == (int)ActorTypes.Agent) |
297 | { | 297 | { |
298 | p2.CollidingObj = true; | 298 | p2.CollidingObj = true; |
299 | contacts[i].depth = 0.003f; | 299 | //contacts[i].depth = 0.003f; |
300 | p2.Velocity = p2.Velocity + new PhysicsVector(0, 0, 2.5f); | 300 | //p2.Velocity = p2.Velocity + new PhysicsVector(0, 0, 2.5f); |
301 | contacts[i].pos = new d.Vector3(contacts[i].pos.X + (p1.Size.X / 2), contacts[i].pos.Y + (p1.Size.Y / 2), contacts[i].pos.Z + (p1.Size.Z / 2)); | 301 | //contacts[i].pos = new d.Vector3(contacts[i].pos.X + (p1.Size.X / 2), contacts[i].pos.Y + (p1.Size.Y / 2), contacts[i].pos.Z + (p1.Size.Z / 2)); |
302 | 302 | ||
303 | } | 303 | } |
304 | else | 304 | else |
@@ -308,13 +308,13 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
308 | if (p1.PhysicsActorType == (int)ActorTypes.Agent) | 308 | if (p1.PhysicsActorType == (int)ActorTypes.Agent) |
309 | { | 309 | { |
310 | p1.CollidingObj = true; | 310 | p1.CollidingObj = true; |
311 | contacts[i].depth = 0.003f; | 311 | //contacts[i].depth = 0.003f; |
312 | p1.Velocity = p1.Velocity + new PhysicsVector(0, 0, 2.5f); | 312 | //p1.Velocity = p1.Velocity + new PhysicsVector(0, 0, 2.5f); |
313 | contacts[i].pos = new d.Vector3(contacts[i].pos.X + (p2.Size.X / 2), contacts[i].pos.Y + (p2.Size.Y / 2), contacts[i].pos.Z + (p2.Size.Z / 2)); | 313 | //contacts[i].pos = new d.Vector3(contacts[i].pos.X + (p2.Size.X / 2), contacts[i].pos.Y + (p2.Size.Y / 2), contacts[i].pos.Z + (p2.Size.Z / 2)); |
314 | } | 314 | } |
315 | else | 315 | else |
316 | { | 316 | { |
317 | contacts[i].depth = 0.0000000f; | 317 | //contacts[i].depth = 0.0000000f; |
318 | } | 318 | } |
319 | } | 319 | } |
320 | // If you interpenetrate a prim with another prim | 320 | // If you interpenetrate a prim with another prim |