aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJeff Ames2007-10-30 09:56:29 +0000
committerJeff Ames2007-10-30 09:56:29 +0000
commitecb2305a04588a24c738b37121d0d915a6a37b04 (patch)
tree34fb34431ef189ace026a6cb5f8df1ed7b8a4829 /OpenSim/Region
parent* Optimized usings (diff)
downloadopensim-SC_OLD-ecb2305a04588a24c738b37121d0d915a6a37b04.zip
opensim-SC_OLD-ecb2305a04588a24c738b37121d0d915a6a37b04.tar.gz
opensim-SC_OLD-ecb2305a04588a24c738b37121d0d915a6a37b04.tar.bz2
opensim-SC_OLD-ecb2305a04588a24c738b37121d0d915a6a37b04.tar.xz
temporary fix for sitting collisions in ODE
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/ClientView.API.cs13
-rw-r--r--OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs5
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs67
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs2
4 files changed, 61 insertions, 26 deletions
diff --git a/OpenSim/Region/ClientStack/ClientView.API.cs b/OpenSim/Region/ClientStack/ClientView.API.cs
index 7dcf1e8..bf2a678 100644
--- a/OpenSim/Region/ClientStack/ClientView.API.cs
+++ b/OpenSim/Region/ClientStack/ClientView.API.cs
@@ -835,19 +835,6 @@ namespace OpenSim.Region.ClientStack
835 OutPacket(avatarReply); 835 OutPacket(avatarReply);
836 } 836 }
837 837
838 public void SendSitResponse(LLUUID targetID, LLVector3 offset)
839 {
840 AvatarSitResponsePacket avatarSitResponse = new AvatarSitResponsePacket();
841
842 avatarSitResponse.SitObject.ID = targetID;
843
844 avatarSitResponse.SitTransform.AutoPilot = true;
845 avatarSitResponse.SitTransform.SitPosition = offset;
846 avatarSitResponse.SitTransform.SitRotation = new LLQuaternion(0.0f, 0.0f, 0.0f, 1.0f);
847
848 OutPacket(avatarSitResponse);
849 }
850
851 #endregion 838 #endregion
852 839
853 #region Appearance/ Wearables Methods 840 #region Appearance/ Wearables Methods
diff --git a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
index dd2562c..7d1780c 100644
--- a/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
+++ b/OpenSim/Region/ClientStack/ClientView.ProcessPackets.cs
@@ -200,12 +200,11 @@ namespace OpenSim.Region.ClientStack
200 } 200 }
201 break; 201 break;
202 case PacketType.AgentRequestSit: 202 case PacketType.AgentRequestSit:
203 AgentRequestSitPacket agentRequestSit = (AgentRequestSitPacket) Pack;
204 SendSitResponse(agentRequestSit.TargetObject.TargetID, agentRequestSit.TargetObject.Offset);
205 if (OnAgentRequestSit != null) 203 if (OnAgentRequestSit != null)
206 { 204 {
205 AgentRequestSitPacket agentRequestSit = (AgentRequestSitPacket)Pack;
207 OnAgentRequestSit(this, agentRequestSit.AgentData.AgentID, 206 OnAgentRequestSit(this, agentRequestSit.AgentData.AgentID,
208 agentRequestSit.TargetObject.TargetID); 207 agentRequestSit.TargetObject.TargetID, agentRequestSit.TargetObject.Offset);
209 } 208 }
210 break; 209 break;
211 case PacketType.AgentSit: 210 case PacketType.AgentSit:
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 527eb22..5155b41 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -50,6 +50,8 @@ namespace OpenSim.Region.Environment.Scenes
50 private readonly List<NewForce> m_forcesList = new List<NewForce>(); 50 private readonly List<NewForce> m_forcesList = new List<NewForce>();
51 private short m_updateCount = 0; 51 private short m_updateCount = 0;
52 private uint m_requestedSitTargetID = 0; 52 private uint m_requestedSitTargetID = 0;
53 private LLVector3 m_requestedSitOffset = new LLVector3();
54 private float m_sitAvatarHeight = 2.0f;
53 55
54 private Quaternion bodyRot; 56 private Quaternion bodyRot;
55 private byte[] m_visualParams; 57 private byte[] m_visualParams;
@@ -448,6 +450,14 @@ namespace OpenSim.Region.Environment.Scenes
448 // return; 450 // return;
449 //} 451 //}
450 452
453 // Must check for standing up even when PhysicsActor is null,
454 // since sitting currently removes avatar from physical scene
455 if ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_STAND_UP) != 0)
456 {
457 StandUp();
458 UpdateMovementAnimations(true);
459 }
460
451 if (PhysicsActor == null) 461 if (PhysicsActor == null)
452 { 462 {
453 // Console.WriteLine("DEBUG: HandleAgentUpdate: null PhysicsActor!"); 463 // Console.WriteLine("DEBUG: HandleAgentUpdate: null PhysicsActor!");
@@ -467,12 +477,6 @@ namespace OpenSim.Region.Environment.Scenes
467 update_movementflag = true; 477 update_movementflag = true;
468 } 478 }
469 479
470 if ((flags & (uint) MainAvatar.ControlFlags.AGENT_CONTROL_STAND_UP) != 0)
471 {
472 StandUp();
473 update_movementflag = true;
474 }
475
476 if (q != bodyRot) 480 if (q != bodyRot)
477 { 481 {
478 bodyRot = q; 482 bodyRot = q;
@@ -517,15 +521,56 @@ namespace OpenSim.Region.Environment.Scenes
517 if (m_parentID != 0) 521 if (m_parentID != 0)
518 { 522 {
519 SceneObjectPart part = m_scene.GetSceneObjectPart(m_parentID); 523 SceneObjectPart part = m_scene.GetSceneObjectPart(m_parentID);
524 LLVector3 pos = new LLVector3();
520 if (part != null) 525 if (part != null)
521 AbsolutePosition = part.AbsolutePosition; 526 pos = part.AbsolutePosition + m_requestedSitOffset + new LLVector3(0.0f, 0.0f, 2.0f * m_sitAvatarHeight);
527 MakeRootAgent(pos, false);
522 m_parentID = 0; 528 m_parentID = 0;
523 SendFullUpdateToAllClients(); 529 SendFullUpdateToAllClients();
524 } 530 }
525 } 531 }
526 532
527 public void HandleAgentRequestSit(IClientAPI remoteClient, LLUUID agentID, LLUUID targetID) 533 private void SendSitResponse(IClientAPI remoteClient, LLUUID targetID, LLVector3 offset)
534 {
535 AvatarSitResponsePacket avatarSitResponse = new AvatarSitResponsePacket();
536
537 avatarSitResponse.SitObject.ID = targetID;
538
539 bool autopilot = true;
540 LLVector3 pos = new LLVector3();
541
542 SceneObjectPart part = m_scene.GetSceneObjectPart(targetID);
543 if (part != null)
544 {
545 pos = part.AbsolutePosition + offset;
546
547 double dist = AbsolutePosition.GetDistanceTo(pos);
548
549 if (m_physicsActor != null)
550 {
551 m_sitAvatarHeight = m_physicsActor.Size.Z;
552 }
553
554// this doesn't seem to quite work yet....
555// // if we're close, set the avatar position to the target position and forgo autopilot
556// if (dist < 2.5)
557// {
558// autopilot = false;
559// AbsolutePosition = pos + new LLVector3(0.0f, 0.0f, m_sitAvatarHeight);
560// }
561 }
562
563 avatarSitResponse.SitTransform.AutoPilot = autopilot;
564 avatarSitResponse.SitTransform.SitPosition = offset;
565 avatarSitResponse.SitTransform.SitRotation = new LLQuaternion(0.0f, 0.0f, 0.0f, 1.0f);
566
567 remoteClient.OutPacket(avatarSitResponse);
568 }
569
570 public void HandleAgentRequestSit(IClientAPI remoteClient, LLUUID agentID, LLUUID targetID, LLVector3 offset)
528 { 571 {
572 SendSitResponse(remoteClient, targetID, offset);
573
529 if (m_parentID != 0) 574 if (m_parentID != 0)
530 { 575 {
531 StandUp(); 576 StandUp();
@@ -537,6 +582,7 @@ namespace OpenSim.Region.Environment.Scenes
537 if (part != null) 582 if (part != null)
538 { 583 {
539 m_requestedSitTargetID = part.LocalID; 584 m_requestedSitTargetID = part.LocalID;
585 m_requestedSitOffset = offset;
540 } 586 }
541 else 587 else
542 { 588 {
@@ -546,8 +592,11 @@ namespace OpenSim.Region.Environment.Scenes
546 592
547 public void HandleAgentSit(IClientAPI remoteClient, LLUUID agentID) 593 public void HandleAgentSit(IClientAPI remoteClient, LLUUID agentID)
548 { 594 {
549 AbsolutePosition = new LLVector3(0F, 0F, 0F); 595 // these magic numbers come mostly from experimenting with ODE,
596 // and seeing what looks right
597 AbsolutePosition = m_requestedSitOffset + new LLVector3(m_physicsActor.Size.X / 2.7f, 0f, m_physicsActor.Size.Z / 1.45f);
550 m_parentID = m_requestedSitTargetID; 598 m_parentID = m_requestedSitTargetID;
599 MakeChildAgent();
551 SendAnimPack(Animations.AnimsLLUUID["SIT"], 1); 600 SendAnimPack(Animations.AnimsLLUUID["SIT"], 1);
552 SendFullUpdateToAllClients(); 601 SendFullUpdateToAllClients();
553 } 602 }
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index c9af6dd..27c3a6a 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -503,7 +503,7 @@ namespace OpenSim.Region.Physics.OdePlugin
503 503
504 public override PhysicsVector Size 504 public override PhysicsVector Size
505 { 505 {
506 get { return new PhysicsVector(0, 0, 0); } 506 get { return new PhysicsVector(CAPSULE_RADIUS*2, CAPSULE_RADIUS*2, CAPSULE_LENGTH); }
507 set { } 507 set { }
508 } 508 }
509 509