mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 00:46:02 +08:00
a few changes on teleport lookat
This commit is contained in:
@@ -407,6 +407,21 @@ namespace OpenSim.Framework
|
||||
|
||||
public Dictionary<string, UUID> MovementAnimationOverRides = new Dictionary<string, UUID>();
|
||||
|
||||
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");
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -64,6 +64,9 @@ namespace OpenSim.Region.Framework.Scenes.Scripting
|
||||
/// <returns></returns>
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user