aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
authorMelanie2011-11-05 21:24:36 +0000
committerMelanie2011-11-05 21:24:36 +0000
commitb6df9e9fe4a4b48901f2e65b85abed379616ca0b (patch)
treebc914d0aacf81661d4413f427418feb274946690 /OpenSim/Region/Framework/Scenes/ScenePresence.cs
parentadd myself to the contributors.txt (diff)
downloadopensim-SC_OLD-b6df9e9fe4a4b48901f2e65b85abed379616ca0b.zip
opensim-SC_OLD-b6df9e9fe4a4b48901f2e65b85abed379616ca0b.tar.gz
opensim-SC_OLD-b6df9e9fe4a4b48901f2e65b85abed379616ca0b.tar.bz2
opensim-SC_OLD-b6df9e9fe4a4b48901f2e65b85abed379616ca0b.tar.xz
Chnaging the sit target adjustment to a more precise approximation of SL. Some small
fixes ported from Avination. Some white space fixes.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs59
1 files changed, 35 insertions, 24 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index e961bdd..1809b84 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -89,7 +89,7 @@ namespace OpenSim.Region.Framework.Scenes
89 /// rotation, prim cut, prim twist, prim taper, and prim shear. See mantis 89 /// rotation, prim cut, prim twist, prim taper, and prim shear. See mantis
90 /// issue #1716 90 /// issue #1716
91 /// </summary> 91 /// </summary>
92 public static readonly Vector3 SIT_TARGET_ADJUSTMENT = new Vector3(0.1f, 0.0f, 0.3f); 92 public static readonly Vector3 SIT_TARGET_ADJUSTMENT = new Vector3(0.0f, 0.0f, 0.418f);
93 93
94 /// <summary> 94 /// <summary>
95 /// Movement updates for agents in neighboring regions are sent directly to clients. 95 /// Movement updates for agents in neighboring regions are sent directly to clients.
@@ -169,7 +169,7 @@ namespace OpenSim.Region.Framework.Scenes
169 169
170 protected ulong crossingFromRegion; 170 protected ulong crossingFromRegion;
171 171
172 private readonly Vector3[] Dir_Vectors = new Vector3[9]; 172 private readonly Vector3[] Dir_Vectors = new Vector3[11];
173 173
174 174
175 protected Timer m_reprioritization_timer; 175 protected Timer m_reprioritization_timer;
@@ -241,6 +241,8 @@ namespace OpenSim.Region.Framework.Scenes
241 DIR_CONTROL_FLAG_DOWN = AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG, 241 DIR_CONTROL_FLAG_DOWN = AgentManager.ControlFlags.AGENT_CONTROL_UP_NEG,
242 DIR_CONTROL_FLAG_FORWARD_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS, 242 DIR_CONTROL_FLAG_FORWARD_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_POS,
243 DIR_CONTROL_FLAG_BACKWARD_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG, 243 DIR_CONTROL_FLAG_BACKWARD_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_AT_NEG,
244 DIR_CONTROL_FLAG_LEFT_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_POS,
245 DIR_CONTROL_FLAG_RIGHT_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_LEFT_NEG,
244 DIR_CONTROL_FLAG_DOWN_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG 246 DIR_CONTROL_FLAG_DOWN_NUDGE = AgentManager.ControlFlags.AGENT_CONTROL_NUDGE_UP_NEG
245 } 247 }
246 248
@@ -479,7 +481,7 @@ namespace OpenSim.Region.Framework.Scenes
479 { 481 {
480 get 482 get
481 { 483 {
482 if (PhysicsActor != null) 484 if (PhysicsActor != null && m_parentID == 0)
483 { 485 {
484 m_pos = PhysicsActor.Position; 486 m_pos = PhysicsActor.Position;
485 487
@@ -507,7 +509,7 @@ namespace OpenSim.Region.Framework.Scenes
507 SceneObjectPart part = m_scene.GetSceneObjectPart(ParentID); 509 SceneObjectPart part = m_scene.GetSceneObjectPart(ParentID);
508 if (part != null) 510 if (part != null)
509 { 511 {
510 return ParentPosition + (m_pos * part.GetWorldRotation()); 512 return part.AbsolutePosition + (m_pos * part.GetWorldRotation());
511 } 513 }
512 else 514 else
513 { 515 {
@@ -816,23 +818,27 @@ namespace OpenSim.Region.Framework.Scenes
816 Dir_Vectors[3] = -Vector3.UnitY; //RIGHT 818 Dir_Vectors[3] = -Vector3.UnitY; //RIGHT
817 Dir_Vectors[4] = Vector3.UnitZ; //UP 819 Dir_Vectors[4] = Vector3.UnitZ; //UP
818 Dir_Vectors[5] = -Vector3.UnitZ; //DOWN 820 Dir_Vectors[5] = -Vector3.UnitZ; //DOWN
819 Dir_Vectors[8] = new Vector3(0f, 0f, -0.5f); //DOWN_Nudge 821 Dir_Vectors[6] = new Vector3(0.5f, 0f, 0f); //FORWARD_NUDGE
820 Dir_Vectors[6] = Vector3.UnitX*2; //FORWARD 822 Dir_Vectors[7] = new Vector3(-0.5f, 0f, 0f); //BACK_NUDGE
821 Dir_Vectors[7] = -Vector3.UnitX; //BACK 823 Dir_Vectors[8] = new Vector3(0f, 0.5f, 0f); //LEFT_NUDGE
824 Dir_Vectors[9] = new Vector3(0f, -0.5f, 0f); //RIGHT_NUDGE
825 Dir_Vectors[10] = new Vector3(0f, 0f, -0.5f); //DOWN_Nudge
822 } 826 }
823 827
824 private Vector3[] GetWalkDirectionVectors() 828 private Vector3[] GetWalkDirectionVectors()
825 { 829 {
826 Vector3[] vector = new Vector3[9]; 830 Vector3[] vector = new Vector3[11];
827 vector[0] = new Vector3(m_CameraUpAxis.Z, 0f, -CameraAtAxis.Z); //FORWARD 831 vector[0] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD
828 vector[1] = new Vector3(-m_CameraUpAxis.Z, 0f, CameraAtAxis.Z); //BACK 832 vector[1] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK
829 vector[2] = Vector3.UnitY; //LEFT 833 vector[2] = Vector3.UnitY; //LEFT
830 vector[3] = -Vector3.UnitY; //RIGHT 834 vector[3] = -Vector3.UnitY; //RIGHT
831 vector[4] = new Vector3(CameraAtAxis.Z, 0f, m_CameraUpAxis.Z); //UP 835 vector[4] = new Vector3(m_CameraAtAxis.Z, 0f, m_CameraUpAxis.Z); //UP
832 vector[5] = new Vector3(-CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN 836 vector[5] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN
833 vector[8] = new Vector3(-CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN_Nudge 837 vector[6] = new Vector3(m_CameraUpAxis.Z, 0f, -m_CameraAtAxis.Z); //FORWARD_NUDGE
834 vector[6] = (new Vector3(m_CameraUpAxis.Z, 0f, -CameraAtAxis.Z) * 2); //FORWARD Nudge 838 vector[7] = new Vector3(-m_CameraUpAxis.Z, 0f, m_CameraAtAxis.Z); //BACK_NUDGE
835 vector[7] = new Vector3(-m_CameraUpAxis.Z, 0f, CameraAtAxis.Z); //BACK Nudge 839 vector[8] = Vector3.UnitY; //LEFT_NUDGE
840 vector[9] = -Vector3.UnitY; //RIGHT_NUDGE
841 vector[10] = new Vector3(-m_CameraAtAxis.Z, 0f, -m_CameraUpAxis.Z); //DOWN_NUDGE
836 return vector; 842 return vector;
837 } 843 }
838 844
@@ -1031,12 +1037,17 @@ namespace OpenSim.Region.Framework.Scenes
1031 { 1037 {
1032 if (PhysicsActor != null) 1038 if (PhysicsActor != null)
1033 { 1039 {
1034 PhysicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients; 1040 try
1035 PhysicsActor.OnOutOfBounds -= OutOfBoundsCall; 1041 {
1036 m_scene.PhysicsScene.RemoveAvatar(PhysicsActor); 1042 PhysicsActor.OnRequestTerseUpdate -= SendTerseUpdateToAllClients;
1037 PhysicsActor.UnSubscribeEvents(); 1043 PhysicsActor.OnOutOfBounds -= OutOfBoundsCall;
1038 PhysicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate; 1044 m_scene.PhysicsScene.RemoveAvatar(PhysicsActor);
1039 PhysicsActor = null; 1045 PhysicsActor.UnSubscribeEvents();
1046 PhysicsActor.OnCollisionUpdate -= PhysicsCollisionUpdate;
1047 PhysicsActor = null;
1048 }
1049 catch
1050 { }
1040 } 1051 }
1041 } 1052 }
1042 1053
@@ -2049,9 +2060,9 @@ namespace OpenSim.Region.Framework.Scenes
2049 m_requestedSitTargetID = part.LocalId; 2060 m_requestedSitTargetID = part.LocalId;
2050 //m_requestedSitOffset = offset; 2061 //m_requestedSitOffset = offset;
2051 m_requestedSitTargetUUID = targetID; 2062 m_requestedSitTargetUUID = targetID;
2052 2063
2053 m_log.DebugFormat("[SIT]: Client requested Sit Position: {0}", offset); 2064 m_log.DebugFormat("[SIT]: Client requested Sit Position: {0}", offset);
2054 2065
2055 if (m_scene.PhysicsScene.SupportsRayCast()) 2066 if (m_scene.PhysicsScene.SupportsRayCast())
2056 { 2067 {
2057 //m_scene.PhysicsScene.RaycastWorld(Vector3.Zero,Vector3.Zero, 0.01f,new RaycastCallback()); 2068 //m_scene.PhysicsScene.RaycastWorld(Vector3.Zero,Vector3.Zero, 0.01f,new RaycastCallback());
@@ -2270,7 +2281,7 @@ namespace OpenSim.Region.Framework.Scenes
2270 HandleAgentSit(remoteClient, agentID, "SIT"); 2281 HandleAgentSit(remoteClient, agentID, "SIT");
2271 } 2282 }
2272 } 2283 }
2273 2284
2274 public void HandleAgentSit(IClientAPI remoteClient, UUID agentID, string sitAnimation) 2285 public void HandleAgentSit(IClientAPI remoteClient, UUID agentID, string sitAnimation)
2275 { 2286 {
2276 SceneObjectPart part = m_scene.GetSceneObjectPart(m_requestedSitTargetID); 2287 SceneObjectPart part = m_scene.GetSceneObjectPart(m_requestedSitTargetID);