diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | 8 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 30 |
2 files changed, 36 insertions, 2 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 58f3dde..71a0e52 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -478,9 +478,17 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
478 | m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.Transferring); | 478 | m_entityTransferStateMachine.UpdateInTransit(sp.UUID, AgentTransferState.Transferring); |
479 | 479 | ||
480 | sp.ControllingClient.SendTeleportStart(teleportFlags); | 480 | sp.ControllingClient.SendTeleportStart(teleportFlags); |
481 | lookAt.Z = 0f; | ||
482 | |||
483 | if(Math.Abs(lookAt.X) < 0.01f && Math.Abs(lookAt.Y) < 0.01f) | ||
484 | { | ||
485 | lookAt.X = 1.0f; | ||
486 | lookAt.Y = 0; | ||
487 | } | ||
481 | 488 | ||
482 | sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); | 489 | sp.ControllingClient.SendLocalTeleport(position, lookAt, teleportFlags); |
483 | sp.TeleportFlags = (Constants.TeleportFlags)teleportFlags; | 490 | sp.TeleportFlags = (Constants.TeleportFlags)teleportFlags; |
491 | sp.RotateToLookAt(lookAt); | ||
484 | sp.Velocity = Vector3.Zero; | 492 | sp.Velocity = Vector3.Zero; |
485 | sp.Teleport(position); | 493 | sp.Teleport(position); |
486 | 494 | ||
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 50ee9d4..cb7422b 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -1927,6 +1927,31 @@ namespace OpenSim.Region.Framework.Scenes | |||
1927 | return true; | 1927 | return true; |
1928 | } | 1928 | } |
1929 | 1929 | ||
1930 | public void RotateToLookAt(Vector3 lookAt) | ||
1931 | { | ||
1932 | if(ParentID == 0) | ||
1933 | { | ||
1934 | float n = lookAt.X * lookAt.X + lookAt.Y * lookAt.Y; | ||
1935 | if(n < 0.0001f) | ||
1936 | { | ||
1937 | Rotation = Quaternion.Identity; | ||
1938 | return; | ||
1939 | } | ||
1940 | n = lookAt.X/(float)Math.Sqrt(n); | ||
1941 | float angle = (float)Math.Acos(n); | ||
1942 | angle *= 0.5f; | ||
1943 | float s = (float)Math.Sin(angle); | ||
1944 | if(lookAt.Y < 0) | ||
1945 | s = -s; | ||
1946 | Rotation = new Quaternion( | ||
1947 | 0f, | ||
1948 | 0f, | ||
1949 | s, | ||
1950 | (float)Math.Cos(angle) | ||
1951 | ); | ||
1952 | } | ||
1953 | } | ||
1954 | |||
1930 | /// <summary> | 1955 | /// <summary> |
1931 | /// Complete Avatar's movement into the region. | 1956 | /// Complete Avatar's movement into the region. |
1932 | /// </summary> | 1957 | /// </summary> |
@@ -1963,10 +1988,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1963 | bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); | 1988 | bool flying = ((m_AgentControlFlags & AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); |
1964 | 1989 | ||
1965 | Vector3 look = Lookat; | 1990 | Vector3 look = Lookat; |
1991 | look.Z = 0f; | ||
1966 | if ((Math.Abs(look.X) < 0.01) && (Math.Abs(look.Y) < 0.01)) | 1992 | if ((Math.Abs(look.X) < 0.01) && (Math.Abs(look.Y) < 0.01)) |
1967 | { | 1993 | { |
1968 | look = Velocity; | 1994 | look = Velocity; |
1969 | look.Z = 0; | ||
1970 | look.Normalize(); | 1995 | look.Normalize(); |
1971 | if ((Math.Abs(look.X) < 0.01) && (Math.Abs(look.Y) < 0.01) ) | 1996 | if ((Math.Abs(look.X) < 0.01) && (Math.Abs(look.Y) < 0.01) ) |
1972 | look = new Vector3(0.99f, 0.042f, 0); | 1997 | look = new Vector3(0.99f, 0.042f, 0); |
@@ -2000,11 +2025,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
2000 | m_log.DebugFormat("[CompleteMovement]: Missing COF for {0} is {1}", client.AgentId, COF); | 2025 | m_log.DebugFormat("[CompleteMovement]: Missing COF for {0} is {1}", client.AgentId, COF); |
2001 | } | 2026 | } |
2002 | 2027 | ||
2028 | if(!gotCrossUpdate) | ||
2029 | RotateToLookAt(look); | ||
2003 | 2030 | ||
2004 | // Tell the client that we're totally ready | 2031 | // Tell the client that we're totally ready |
2005 | ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); | 2032 | ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); |
2006 | 2033 | ||
2007 | |||
2008 | m_log.DebugFormat("[CompleteMovement] MoveAgentIntoRegion: {0}ms", Util.EnvironmentTickCountSubtract(ts)); | 2034 | m_log.DebugFormat("[CompleteMovement] MoveAgentIntoRegion: {0}ms", Util.EnvironmentTickCountSubtract(ts)); |
2009 | 2035 | ||
2010 | if (!string.IsNullOrEmpty(m_callbackURI)) | 2036 | if (!string.IsNullOrEmpty(m_callbackURI)) |