From cfce2529ad7dd41ca3c82f378f41491f1b38d9c4 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 5 Nov 2011 02:04:48 +0000 Subject: refactor: In sit code, compare against Vector3.Zero and Quaternion.Identity instead of individual components of a vector/quat --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'OpenSim/Region') 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 } #region Client Camera - // Position of agent's camera in world (region cordinates) + + /// + /// Position of agent's camera in world (region cordinates) + /// protected Vector3 m_lastCameraPosition; protected Vector3 m_CameraPosition; @@ -1911,14 +1914,12 @@ namespace OpenSim.Region.Framework.Scenes foreach (SceneObjectPart part in partArray) { // Is a sit target available? - Vector3 avSitOffSet = part.SitTargetPosition; + Vector3 avSitOffset = part.SitTargetPosition; Quaternion avSitOrientation = part.SitTargetOrientation; UUID avOnTargetAlready = part.SitTargetAvatar; - bool SitTargetUnOccupied = (!(avOnTargetAlready != UUID.Zero)); - bool SitTargetisSet = - (!(avSitOffSet.X == 0f && avSitOffSet.Y == 0f && avSitOffSet.Z == 0f && avSitOrientation.W == 1f && - avSitOrientation.X == 0f && avSitOrientation.Y == 0f && avSitOrientation.Z == 0f)); + bool SitTargetUnOccupied = avOnTargetAlready == UUID.Zero; + bool SitTargetisSet = avSitOffset != Vector3.Zero || avSitOrientation != Quaternion.Identity; if (SitTargetisSet && SitTargetUnOccupied) { @@ -1940,7 +1941,6 @@ namespace OpenSim.Region.Framework.Scenes Vector3 cameraAtOffset = Vector3.Zero; bool forceMouselook = false; - //SceneObjectPart part = m_scene.GetSceneObjectPart(targetID); SceneObjectPart part = FindNextAvailableSitTarget(targetID); if (part != null) { @@ -1954,9 +1954,9 @@ namespace OpenSim.Region.Framework.Scenes bool SitTargetUnOccupied = (!(avOnTargetAlready != UUID.Zero)); bool SitTargetisSet = - (!(avSitOffSet.X == 0f && avSitOffSet.Y == 0f && avSitOffSet.Z == 0f && + (!(avSitOffSet == Vector3.Zero && ( - avSitOrientation.X == 0f && avSitOrientation.Y == 0f && avSitOrientation.Z == 0f && avSitOrientation.W == 1f // Valid Zero Rotation quaternion + avSitOrientation == Quaternion.Identity // Valid Zero Rotation quaternion || avSitOrientation.X == 0f && avSitOrientation.Y == 0f && avSitOrientation.Z == 1f && avSitOrientation.W == 0f // W-Z Mapping was invalid at one point || avSitOrientation.X == 0f && avSitOrientation.Y == 0f && avSitOrientation.Z == 0f && avSitOrientation.W == 0f // Invalid Quaternion ) @@ -2008,6 +2008,7 @@ namespace OpenSim.Region.Framework.Scenes ControllingClient.SendSitResponse(targetID, offset, sitOrientation, autopilot, cameraAtOffset, cameraEyeOffset, forceMouselook); m_requestedSitTargetUUID = targetID; + // This calls HandleAgentSit twice, once from here, and the client calls // HandleAgentSit itself after it gets to the location // It doesn't get to the location until we've moved them there though @@ -2292,15 +2293,13 @@ namespace OpenSim.Region.Framework.Scenes //Quaternion result = (sitTargetOrient * vq) * nq; - m_pos = new Vector3(sitTargetPos.X, sitTargetPos.Y, sitTargetPos.Z); - m_pos += SIT_TARGET_ADJUSTMENT; + m_pos = sitTargetPos + SIT_TARGET_ADJUSTMENT; Rotation = sitTargetOrient; ParentPosition = part.AbsolutePosition; } else { m_pos -= part.AbsolutePosition; - ParentPosition = part.AbsolutePosition; // m_log.DebugFormat( @@ -2313,6 +2312,7 @@ namespace OpenSim.Region.Framework.Scenes return; } } + ParentID = m_requestedSitTargetID; Velocity = Vector3.Zero; -- cgit v1.1 From e3885625a069e5d6a59ad0300215c13c89ea00f8 Mon Sep 17 00:00:00 2001 From: nebadon Date: Sat, 5 Nov 2011 02:26:25 -0700 Subject: Don't rotate child prims, if only the root prim is rotated. --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 4d6c4cb..3f4e112 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2926,8 +2926,8 @@ namespace OpenSim.Region.Framework.Scenes axPos *= Quaternion.Inverse(axRot); prim.OffsetPosition = axPos; Quaternion primsRot = prim.RotationOffset; - Quaternion newRot = primsRot * oldParentRot; - newRot *= Quaternion.Inverse(axRot); + Quaternion newRot = oldParentRot * primsRot; + newRot = Quaternion.Inverse(axRot) * newRot; prim.RotationOffset = newRot; prim.ScheduleTerseUpdate(); prim.IgnoreUndoUpdate = false; -- cgit v1.1 From e182cc198d3b0151b2a891f6470e664f77e42d79 Mon Sep 17 00:00:00 2001 From: nebadon Date: Sat, 5 Nov 2011 02:56:52 -0700 Subject: Fix avatar height, removes the hip offset hack Author: Mana Janus --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 3 --- 1 file changed, 3 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 0ff93f6..e961bdd 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2445,9 +2445,6 @@ namespace OpenSim.Region.Framework.Scenes // server. if (remoteClient.IsActive) { - Vector3 pos = m_pos; - pos.Z += Appearance.HipOffset; - //m_log.DebugFormat("[SCENE PRESENCE]: " + Name + " sending TerseUpdate to " + remoteClient.Name + " : Pos={0} Rot={1} Vel={2}", m_pos, Rotation, m_velocity); remoteClient.SendEntityUpdate( -- cgit v1.1