aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-11-05 02:04:48 +0000
committerJustin Clark-Casey (justincc)2011-11-05 02:04:48 +0000
commitcfce2529ad7dd41ca3c82f378f41491f1b38d9c4 (patch)
treeed05012696486e59c32f050bf2e86de64a03f21d /OpenSim
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-cfce2529ad7dd41ca3c82f378f41491f1b38d9c4.zip
opensim-SC_OLD-cfce2529ad7dd41ca3c82f378f41491f1b38d9c4.tar.gz
opensim-SC_OLD-cfce2529ad7dd41ca3c82f378f41491f1b38d9c4.tar.bz2
opensim-SC_OLD-cfce2529ad7dd41ca3c82f378f41491f1b38d9c4.tar.xz
refactor: In sit code, compare against Vector3.Zero and Quaternion.Identity instead of individual components of a vector/quat
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs24
1 files changed, 12 insertions, 12 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 4156f21..0ff93f6 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -320,7 +320,10 @@ namespace OpenSim.Region.Framework.Scenes
320 } 320 }
321 321
322 #region Client Camera 322 #region Client Camera
323 // Position of agent's camera in world (region cordinates) 323
324 /// <summary>
325 /// Position of agent's camera in world (region cordinates)
326 /// </summary>
324 protected Vector3 m_lastCameraPosition; 327 protected Vector3 m_lastCameraPosition;
325 328
326 protected Vector3 m_CameraPosition; 329 protected Vector3 m_CameraPosition;
@@ -1911,14 +1914,12 @@ namespace OpenSim.Region.Framework.Scenes
1911 foreach (SceneObjectPart part in partArray) 1914 foreach (SceneObjectPart part in partArray)
1912 { 1915 {
1913 // Is a sit target available? 1916 // Is a sit target available?
1914 Vector3 avSitOffSet = part.SitTargetPosition; 1917 Vector3 avSitOffset = part.SitTargetPosition;
1915 Quaternion avSitOrientation = part.SitTargetOrientation; 1918 Quaternion avSitOrientation = part.SitTargetOrientation;
1916 UUID avOnTargetAlready = part.SitTargetAvatar; 1919 UUID avOnTargetAlready = part.SitTargetAvatar;
1917 1920
1918 bool SitTargetUnOccupied = (!(avOnTargetAlready != UUID.Zero)); 1921 bool SitTargetUnOccupied = avOnTargetAlready == UUID.Zero;
1919 bool SitTargetisSet = 1922 bool SitTargetisSet = avSitOffset != Vector3.Zero || avSitOrientation != Quaternion.Identity;
1920 (!(avSitOffSet.X == 0f && avSitOffSet.Y == 0f && avSitOffSet.Z == 0f && avSitOrientation.W == 1f &&
1921 avSitOrientation.X == 0f && avSitOrientation.Y == 0f && avSitOrientation.Z == 0f));
1922 1923
1923 if (SitTargetisSet && SitTargetUnOccupied) 1924 if (SitTargetisSet && SitTargetUnOccupied)
1924 { 1925 {
@@ -1940,7 +1941,6 @@ namespace OpenSim.Region.Framework.Scenes
1940 Vector3 cameraAtOffset = Vector3.Zero; 1941 Vector3 cameraAtOffset = Vector3.Zero;
1941 bool forceMouselook = false; 1942 bool forceMouselook = false;
1942 1943
1943 //SceneObjectPart part = m_scene.GetSceneObjectPart(targetID);
1944 SceneObjectPart part = FindNextAvailableSitTarget(targetID); 1944 SceneObjectPart part = FindNextAvailableSitTarget(targetID);
1945 if (part != null) 1945 if (part != null)
1946 { 1946 {
@@ -1954,9 +1954,9 @@ namespace OpenSim.Region.Framework.Scenes
1954 1954
1955 bool SitTargetUnOccupied = (!(avOnTargetAlready != UUID.Zero)); 1955 bool SitTargetUnOccupied = (!(avOnTargetAlready != UUID.Zero));
1956 bool SitTargetisSet = 1956 bool SitTargetisSet =
1957 (!(avSitOffSet.X == 0f && avSitOffSet.Y == 0f && avSitOffSet.Z == 0f && 1957 (!(avSitOffSet == Vector3.Zero &&
1958 ( 1958 (
1959 avSitOrientation.X == 0f && avSitOrientation.Y == 0f && avSitOrientation.Z == 0f && avSitOrientation.W == 1f // Valid Zero Rotation quaternion 1959 avSitOrientation == Quaternion.Identity // Valid Zero Rotation quaternion
1960 || avSitOrientation.X == 0f && avSitOrientation.Y == 0f && avSitOrientation.Z == 1f && avSitOrientation.W == 0f // W-Z Mapping was invalid at one point 1960 || avSitOrientation.X == 0f && avSitOrientation.Y == 0f && avSitOrientation.Z == 1f && avSitOrientation.W == 0f // W-Z Mapping was invalid at one point
1961 || avSitOrientation.X == 0f && avSitOrientation.Y == 0f && avSitOrientation.Z == 0f && avSitOrientation.W == 0f // Invalid Quaternion 1961 || avSitOrientation.X == 0f && avSitOrientation.Y == 0f && avSitOrientation.Z == 0f && avSitOrientation.W == 0f // Invalid Quaternion
1962 ) 1962 )
@@ -2008,6 +2008,7 @@ namespace OpenSim.Region.Framework.Scenes
2008 2008
2009 ControllingClient.SendSitResponse(targetID, offset, sitOrientation, autopilot, cameraAtOffset, cameraEyeOffset, forceMouselook); 2009 ControllingClient.SendSitResponse(targetID, offset, sitOrientation, autopilot, cameraAtOffset, cameraEyeOffset, forceMouselook);
2010 m_requestedSitTargetUUID = targetID; 2010 m_requestedSitTargetUUID = targetID;
2011
2011 // This calls HandleAgentSit twice, once from here, and the client calls 2012 // This calls HandleAgentSit twice, once from here, and the client calls
2012 // HandleAgentSit itself after it gets to the location 2013 // HandleAgentSit itself after it gets to the location
2013 // It doesn't get to the location until we've moved them there though 2014 // It doesn't get to the location until we've moved them there though
@@ -2292,15 +2293,13 @@ namespace OpenSim.Region.Framework.Scenes
2292 2293
2293 //Quaternion result = (sitTargetOrient * vq) * nq; 2294 //Quaternion result = (sitTargetOrient * vq) * nq;
2294 2295
2295 m_pos = new Vector3(sitTargetPos.X, sitTargetPos.Y, sitTargetPos.Z); 2296 m_pos = sitTargetPos + SIT_TARGET_ADJUSTMENT;
2296 m_pos += SIT_TARGET_ADJUSTMENT;
2297 Rotation = sitTargetOrient; 2297 Rotation = sitTargetOrient;
2298 ParentPosition = part.AbsolutePosition; 2298 ParentPosition = part.AbsolutePosition;
2299 } 2299 }
2300 else 2300 else
2301 { 2301 {
2302 m_pos -= part.AbsolutePosition; 2302 m_pos -= part.AbsolutePosition;
2303
2304 ParentPosition = part.AbsolutePosition; 2303 ParentPosition = part.AbsolutePosition;
2305 2304
2306// m_log.DebugFormat( 2305// m_log.DebugFormat(
@@ -2313,6 +2312,7 @@ namespace OpenSim.Region.Framework.Scenes
2313 return; 2312 return;
2314 } 2313 }
2315 } 2314 }
2315
2316 ParentID = m_requestedSitTargetID; 2316 ParentID = m_requestedSitTargetID;
2317 2317
2318 Velocity = Vector3.Zero; 2318 Velocity = Vector3.Zero;