diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index 6097cf3cc9..0cfc1d694e 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs @@ -407,6 +407,21 @@ namespace OpenSim.Framework public Dictionary MovementAnimationOverRides = new Dictionary(); + public void SetLookAt(Vector3 value) + { + if (value == Vector3.Zero) + { + AtAxis = Vector3.UnitX; + LeftAxis = Vector3.UnitY; + AtAxis = Vector3.UnitZ; + return; + } + AtAxis = new Vector3(value.X, value.Y, 0); + AtAxis.Normalize(); + LeftAxis = new Vector3(-AtAxis.Y, AtAxis.X, 0); + UpAxis = Vector3.UnitZ; + } + public virtual OSDMap Pack(EntityTransferContext ctx) { // m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Pack data"); diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 880c7deb8c..04572a2aca 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -845,13 +845,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // We're going to fallback to V1 if the destination gives us anything smaller than 0.2 if (ctx.OutboundVersion >= 0.2f) - TransferAgent_V2(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, OutSideViewRange , ctx, out reason); + TransferAgent_V2(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, OutSideViewRange, lookAt, ctx, out reason); else - TransferAgent_V1(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, OutSideViewRange, ctx, out reason); + TransferAgent_V1(sp, agentCircuit, reg, finalDestination, endPoint, teleportFlags, OutSideViewRange, lookAt, ctx, out reason); } private void TransferAgent_V1(ScenePresence sp, AgentCircuitData agentCircuit, GridRegion reg, GridRegion finalDestination, - IPEndPoint endPoint, uint teleportFlags, bool OutSideViewRange, EntityTransferContext ctx, out string reason) + IPEndPoint endPoint, uint teleportFlags, bool OutSideViewRange, Vector3 lookAt, EntityTransferContext ctx, out string reason) { ulong destinationHandle = finalDestination.RegionHandle; AgentCircuitData currentAgentCircuit = sp.Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); @@ -947,6 +947,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // Let's send a full update of the agent. This is a synchronous call. AgentData agent = new AgentData(); sp.CopyTo(agent,false); + agent.SetLookAt(lookAt); if ((teleportFlags & (uint)TeleportFlags.IsFlying) != 0) agent.ControlFlags |= (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; @@ -1089,7 +1090,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer } private void TransferAgent_V2(ScenePresence sp, AgentCircuitData agentCircuit, GridRegion reg, GridRegion finalDestination, - IPEndPoint endPoint, uint teleportFlags, bool OutSideViewRange, EntityTransferContext ctx, out string reason) + IPEndPoint endPoint, uint teleportFlags, bool OutSideViewRange, Vector3 lookAt, EntityTransferContext ctx, out string reason) { ulong destinationHandle = finalDestination.RegionHandle; @@ -1176,6 +1177,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // Let's send a full update of the agent. AgentData agent = new AgentData(); sp.CopyTo(agent,false); + agent.SetLookAt(lookAt); agent.Position = agentCircuit.startpos; if ((teleportFlags & (uint)TeleportFlags.IsFlying) != 0) diff --git a/OpenSim/Region/Framework/Scenes/Scripting/ScriptUtils.cs b/OpenSim/Region/Framework/Scenes/Scripting/ScriptUtils.cs index d6b8b573b0..c653bdbba1 100644 --- a/OpenSim/Region/Framework/Scenes/Scripting/ScriptUtils.cs +++ b/OpenSim/Region/Framework/Scenes/Scripting/ScriptUtils.cs @@ -64,6 +64,9 @@ namespace OpenSim.Region.Framework.Scenes.Scripting /// public static UUID GetAssetIdFromKeyOrItemName(SceneObjectPart part, string identifier) { + if(string.IsNullOrEmpty(identifier)) + return UUID.Zero; + // if we can parse the string as a key, use it. // else try to locate the name in inventory of object. found returns key, // not found returns UUID.Zero