aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/ScenePresence.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs40
1 files changed, 12 insertions, 28 deletions
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 83d3306..b8a2555 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -77,7 +77,6 @@ namespace OpenSim.Region.Environment.Scenes
77 private LLVector3 lastPhysPos = new LLVector3(); 77 private LLVector3 lastPhysPos = new LLVector3();
78 private int m_wearablesSerial = 1; 78 private int m_wearablesSerial = 1;
79 79
80
81 // Position of agent's camera in world 80 // Position of agent's camera in world
82 protected Vector3 m_CameraCenter = new Vector3(0, 0, 0); 81 protected Vector3 m_CameraCenter = new Vector3(0, 0, 0);
83 82
@@ -553,7 +552,7 @@ namespace OpenSim.Region.Environment.Scenes
553 } 552 }
554 } 553 }
555 554
556 public void HandleAgentUpdate(IClientAPI remoteClient,AgentUpdatePacket agentData ) 555 public void HandleAgentUpdate(IClientAPI remoteClient, AgentUpdatePacket agentData)
557 { 556 {
558 //if (m_isChildAgent) 557 //if (m_isChildAgent)
559 //{ 558 //{
@@ -573,7 +572,6 @@ namespace OpenSim.Region.Environment.Scenes
573 m_CameraCenter.y = agentData.AgentData.CameraCenter.Y; 572 m_CameraCenter.y = agentData.AgentData.CameraCenter.Y;
574 m_CameraCenter.z = agentData.AgentData.CameraCenter.Z; 573 m_CameraCenter.z = agentData.AgentData.CameraCenter.Z;
575 574
576
577 // Use these three vectors to figure out what the agent is looking at 575 // Use these three vectors to figure out what the agent is looking at
578 // Convert it to a Matrix and/or Quaternion 576 // Convert it to a Matrix and/or Quaternion
579 m_CameraAtAxis.x = agentData.AgentData.CameraAtAxis.X; 577 m_CameraAtAxis.x = agentData.AgentData.CameraAtAxis.X;
@@ -632,7 +630,6 @@ namespace OpenSim.Region.Environment.Scenes
632 Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z); 630 Quaternion q = new Quaternion(bodyRotation.W, bodyRotation.X, bodyRotation.Y, bodyRotation.Z);
633 bool oldflying = PhysicsActor.Flying; 631 bool oldflying = PhysicsActor.Flying;
634 632
635
636 PhysicsActor.Flying = ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0); 633 PhysicsActor.Flying = ((flags & (uint)MainAvatar.ControlFlags.AGENT_CONTROL_FLY) != 0);
637 if (PhysicsActor.Flying != oldflying) 634 if (PhysicsActor.Flying != oldflying)
638 { 635 {
@@ -883,10 +880,10 @@ namespace OpenSim.Region.Environment.Scenes
883 } 880 }
884 881
885 NewForce newVelocity = new NewForce(); 882 NewForce newVelocity = new NewForce();
886 Vector3 direc = rotation*vec; 883 Vector3 direc = rotation * vec;
887 direc.Normalize(); 884 direc.Normalize();
888 885
889 direc = direc*((0.03f)*128f); 886 direc *= 0.03f * 128f;
890 if (m_physicsActor.Flying) 887 if (m_physicsActor.Flying)
891 { 888 {
892 direc *= 4; 889 direc *= 4;
@@ -944,15 +941,12 @@ namespace OpenSim.Region.Environment.Scenes
944 941
945 if (m_isChildAgent == false) 942 if (m_isChildAgent == false)
946 { 943 {
947 /// check for user movement 'forces' (ie commands to move) 944 if (m_newForce) // user movement 'forces' (ie commands to move)
948 if (m_newForce)
949 { 945 {
950 SendTerseUpdateToAllClients(); 946 SendTerseUpdateToAllClients();
951 m_updateCount = 0; 947 m_updateCount = 0;
952 } 948 }
953 949 else if (m_movementflag != 0) // scripted movement (?)
954 /// check for scripted movement (?)
955 else if (m_movementflag != 0)
956 { 950 {
957 m_updateCount++; 951 m_updateCount++;
958 if (m_updateCount > 3) 952 if (m_updateCount > 3)
@@ -961,9 +955,7 @@ namespace OpenSim.Region.Environment.Scenes
961 m_updateCount = 0; 955 m_updateCount = 0;
962 } 956 }
963 } 957 }
964 958 else if (lastPhysPos.GetDistanceTo(AbsolutePosition) > 0.02) // physics-related movement
965 /// check for physics-related movement
966 else if (lastPhysPos.GetDistanceTo(AbsolutePosition) > 0.02)
967 { 959 {
968 SendTerseUpdateToAllClients(); 960 SendTerseUpdateToAllClients();
969 m_updateCount = 0; 961 m_updateCount = 0;
@@ -1071,9 +1063,9 @@ namespace OpenSim.Region.Environment.Scenes
1071 /// 1063 ///
1072 /// </summary> 1064 /// </summary>
1073 /// <param name="client"></param> 1065 /// <param name="client"></param>
1074 public void SendOwnAppearance( ) 1066 public void SendOwnAppearance()
1075 { 1067 {
1076 SendOwnWearables( ); 1068 SendOwnWearables();
1077 1069
1078 // TODO: remove this once the SunModule is slightly more tested 1070 // TODO: remove this once the SunModule is slightly more tested
1079 // m_controllingClient.SendViewerTime(m_scene.TimePhase); 1071 // m_controllingClient.SendViewerTime(m_scene.TimePhase);
@@ -1224,7 +1216,6 @@ namespace OpenSim.Region.Environment.Scenes
1224 1216
1225 #endregion 1217 #endregion
1226 1218
1227
1228 public void GrantGodlikePowers(LLUUID agentID, LLUUID sessionID, LLUUID token) 1219 public void GrantGodlikePowers(LLUUID agentID, LLUUID sessionID, LLUUID token)
1229 { 1220 {
1230 GrantGodlikePowersPacket respondPacket = new GrantGodlikePowersPacket(); 1221 GrantGodlikePowersPacket respondPacket = new GrantGodlikePowersPacket();
@@ -1240,10 +1231,8 @@ namespace OpenSim.Region.Environment.Scenes
1240 respondPacket.GrantData = gdb; 1231 respondPacket.GrantData = gdb;
1241 respondPacket.AgentData = adb; 1232 respondPacket.AgentData = adb;
1242 ControllingClient.OutPacket(respondPacket, ThrottleOutPacketType.Task); 1233 ControllingClient.OutPacket(respondPacket, ThrottleOutPacketType.Task);
1243
1244
1245
1246 } 1234 }
1235
1247 /// <summary> 1236 /// <summary>
1248 /// 1237 ///
1249 /// </summary> 1238 /// </summary>
@@ -1267,7 +1256,6 @@ namespace OpenSim.Region.Environment.Scenes
1267 1256
1268 m_updateflag = true; 1257 m_updateflag = true;
1269 1258
1270
1271 Velocity = new LLVector3(force.X, force.Y, force.Z); 1259 Velocity = new LLVector3(force.X, force.Y, force.Z);
1272 m_newForce = true; 1260 m_newForce = true;
1273 } 1261 }
@@ -1317,7 +1305,6 @@ namespace OpenSim.Region.Environment.Scenes
1317 } 1305 }
1318 } 1306 }
1319 1307
1320
1321 public override void SetText(string text, Vector3 color, double alpha) 1308 public override void SetText(string text, Vector3 color, double alpha)
1322 { 1309 {
1323 throw new Exception("Can't set Text on avatar."); 1310 throw new Exception("Can't set Text on avatar.");
@@ -1335,14 +1322,13 @@ namespace OpenSim.Region.Environment.Scenes
1335 m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients; 1322 m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients;
1336 m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate; 1323 m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate;
1337 } 1324 }
1325
1338 private void PhysicsCollisionUpdate(EventArgs e) 1326 private void PhysicsCollisionUpdate(EventArgs e)
1339 { 1327 {
1340 bool isUserMoving = false; 1328 bool isUserMoving = Velocity.X > 0 || Velocity.Y > 0;
1341 if (Velocity.X > 0 || Velocity.Y > 0)
1342 isUserMoving = true;
1343 UpdateMovementAnimations(isUserMoving); 1329 UpdateMovementAnimations(isUserMoving);
1344
1345 } 1330 }
1331
1346 internal void Close() 1332 internal void Close()
1347 { 1333 {
1348 RemoveFromPhysicalScene(); 1334 RemoveFromPhysicalScene();
@@ -1352,13 +1338,11 @@ namespace OpenSim.Region.Environment.Scenes
1352 { 1338 {
1353 m_wearables[wearableId] = wearable; 1339 m_wearables[wearableId] = wearable;
1354 SendOwnWearables(); 1340 SendOwnWearables();
1355
1356 } 1341 }
1357 1342
1358 private void SendOwnWearables() 1343 private void SendOwnWearables()
1359 { 1344 {
1360 m_controllingClient.SendWearables(m_wearables, m_wearablesSerial++); 1345 m_controllingClient.SendWearables(m_wearables, m_wearablesSerial++);
1361 } 1346 }
1362
1363 } 1347 }
1364} 1348}