Added a new RegionSyncMessage, AvatarTeleportSameRegion, for PSA to inform PE to
update avatar positon after teleporting within the same region, and the logic to send/receive the message. Teleporting within the same region seems working now with remote PE.dsg
parent
3c58a1c244
commit
e2b6c5d199
|
@ -370,6 +370,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
}
|
||||
pa.ChangingActorID = actorID;
|
||||
m_validLocalScene.PhysicsScene.AddPhysicsActorTaint(pa);
|
||||
|
||||
//m_log.DebugFormat("HandlePhysUpdateAttributes, ChangingActorID = {0}, PA pos = {1}, data.position={2}", pa.ChangingActorID, pa.Position, data["position"].AsVector3().ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -369,6 +369,62 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
return;
|
||||
|
||||
}
|
||||
case RegionSyncMessage.MsgType.AvatarTeleportSameRegion:
|
||||
{
|
||||
if (PhysEngineToSceneConnectorModule.IsPhysEngineActorS)
|
||||
{
|
||||
OSDMap data = DeserializeMessage(msg);
|
||||
if (data == null)
|
||||
{
|
||||
RegionSyncMessage.HandleError(LogHeader(), msg, "Could not deserialize JSON data.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the parameters from data and error check
|
||||
UUID agentID = UUID.Zero;
|
||||
Vector3 pos = Vector3.Zero;
|
||||
|
||||
try
|
||||
{
|
||||
agentID = data["id"].AsUUID();
|
||||
pos = data["pos"].AsVector3();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("{0} Caught exception in UpdatedAvatar handler (Decoding JSON): {1}", LogHeader(), e.Message);
|
||||
}
|
||||
|
||||
// Find the presence in the scene and error check
|
||||
ScenePresence presence;
|
||||
m_scene.TryGetScenePresence(agentID, out presence);
|
||||
if (presence == null)
|
||||
{
|
||||
//RegionSyncMessage.HandleWarning(LogHeader(), msg, String.Format("agentID {0} not found.", agentID.ToString()));
|
||||
return;
|
||||
}
|
||||
|
||||
if (presence.IsBalancing && presence.ControllingClient is RegionSyncAvatar)
|
||||
{
|
||||
lock (m_syncRoot)
|
||||
{
|
||||
if (m_localAvatars.ContainsKey(presence.UUID))
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat("{0} Received update for balancing avatar not in local avatar list. \"{1}\"", LogHeader(), presence.Name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
presence.Teleport(pos);
|
||||
|
||||
//m_log.DebugFormat("Received AvatarTeleportSameRegion: Teleport {0} to pos {1}, now pa.pos = {2}", presence.Name, pos, presence.PhysicsActor.Position);
|
||||
}
|
||||
return;
|
||||
}
|
||||
case RegionSyncMessage.MsgType.UpdatedAvatar:
|
||||
{
|
||||
// Get the data from message and error check
|
||||
|
@ -464,7 +520,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
{
|
||||
presence.AgentControlFlags = flags;
|
||||
presence.AbsolutePosition = pos;
|
||||
m_log.DebugFormat("{0}: UpdateAvatar. Setting vel={1}", LogHeader(), vel);
|
||||
//m_log.DebugFormat("{0}: UpdateAvatar. Setting vel={1}, AbsolutePosition = {1}", LogHeader(), vel, presence.AbsolutePosition);
|
||||
presence.Velocity = vel;
|
||||
presence.Rotation = rot;
|
||||
// It seems the physics scene can drop an avatar if the avatar makes it angry
|
||||
|
|
|
@ -66,7 +66,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
ActorConnect,
|
||||
AgentAdd,
|
||||
AgentUpdate,
|
||||
AgentSameRegionTeleport,
|
||||
AgentSameRegionTeleport, //from CM to PSA
|
||||
AgentRemove,
|
||||
AgentRequestSit,
|
||||
AgentSit,
|
||||
|
@ -83,6 +83,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
ChatFromClient,
|
||||
AvatarTeleportOut, // An LLClientView (real client) was converted to a RegionSyncAvatar
|
||||
AvatarTeleportIn, // A RegionSyncAvatar was converted to an LLClientView (real client)
|
||||
AvatarTeleportSameRegion, //from PSA to PE
|
||||
// SIM -> CM
|
||||
//Terrain,
|
||||
//NewObject, // objects
|
||||
|
|
|
@ -234,6 +234,53 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
//m_log.DebugFormat("[REGION SYNC SERVER MODULE] QueuePresenceForUpdate: {0}", presence.UUID.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Send a teleport message out. This should only be called when teleporting within the same region.
|
||||
/// </summary>
|
||||
/// <param name="presence"></param>
|
||||
public void SendTeleportUpdate(ScenePresence presence)
|
||||
{
|
||||
if (!Active || !Synced)
|
||||
return;
|
||||
|
||||
System.Threading.ThreadPool.QueueUserWorkItem(delegate
|
||||
{
|
||||
OSDMap data = new OSDMap(10);
|
||||
data["id"] = OSD.FromUUID(presence.UUID);
|
||||
// Do not include offset for appearance height. That will be handled by RegionSyncClient before sending to viewers
|
||||
if (presence.AbsolutePosition.IsFinite())
|
||||
data["pos"] = OSD.FromVector3(presence.AbsolutePosition);
|
||||
else
|
||||
data["pos"] = OSD.FromVector3(Vector3.Zero);
|
||||
/*
|
||||
if (presence.Velocity.IsFinite())
|
||||
data["vel"] = OSD.FromVector3(presence.Velocity);
|
||||
else
|
||||
data["vel"] = OSD.FromVector3(Vector3.Zero);
|
||||
if (System.Single.IsNaN(presence.Rotation.X))
|
||||
data["rot"] = OSD.FromQuaternion(Quaternion.Identity);
|
||||
else
|
||||
data["rot"] = OSD.FromQuaternion(presence.Rotation);
|
||||
data["fly"] = OSD.FromBoolean(presence.Flying);
|
||||
data["flags"] = OSD.FromUInteger((uint)presence.AgentControlFlags);
|
||||
data["anim"] = OSD.FromString(presence.Animator.CurrentMovementAnimation);
|
||||
// needed for a full update
|
||||
if (presence.ParentID != presence.lastSentParentID)
|
||||
{
|
||||
data["coll"] = OSD.FromVector4(presence.CollisionPlane);
|
||||
data["off"] = OSD.FromVector3(presence.OffsetPosition);
|
||||
data["pID"] = OSD.FromUInteger(presence.ParentID);
|
||||
presence.lastSentParentID = presence.ParentID;
|
||||
}
|
||||
* */
|
||||
|
||||
RegionSyncMessage rsm = new RegionSyncMessage(RegionSyncMessage.MsgType.AvatarTeleportSameRegion, OSDParser.SerializeJsonString(data));
|
||||
|
||||
m_server.Broadcast(rsm);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void SendUpdates()
|
||||
{
|
||||
if (!Active || !Synced)
|
||||
|
|
|
@ -434,6 +434,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
|
|||
data["isColliding"] = OSD.FromBoolean(pa.IsColliding);
|
||||
data["isCollidingGround"] = OSD.FromBoolean(pa.CollidingGround);
|
||||
|
||||
//m_log.DebugFormat("SendPhysUpdateAttributes, ChangingActorID = {0}, with PA at pos {1}, data.position={2}", pa.ChangingActorID, pa.Position, data["position"].AsVector3().ToString());
|
||||
|
||||
RegionSyncMessage rsm = new RegionSyncMessage(RegionSyncMessage.MsgType.PhysUpdateAttributes,
|
||||
OSDParser.SerializeJsonString(data));
|
||||
Send(rsm);
|
||||
|
|
|
@ -44,5 +44,6 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
void SendAppearance(UUID agentID);
|
||||
void SendAnimations(UUID agentID, UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs);
|
||||
|
||||
void SendTeleportUpdate(ScenePresence presence);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1099,6 +1099,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
|
||||
SendTerseUpdateToAllClients();
|
||||
|
||||
//This should only happen on PSA and when the teleport is within the same region.
|
||||
//If teleport is to a remote region, CM will handle it and PSA should be
|
||||
//executing inside this function.
|
||||
SendTeleportUpdate();
|
||||
}
|
||||
|
||||
public void TeleportWithMomentum(Vector3 pos)
|
||||
|
@ -3976,5 +3981,20 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region REGION SYNC
|
||||
public void SendTeleportUpdate()
|
||||
{
|
||||
// m_log.DebugFormat("[SCENE PRESENCE]: TerseUpdate: UUID={0}, pos={1}", m_physicsActor.UUID.ToString(), m_physicsActor.Position.ToString());
|
||||
// REGION SYNC
|
||||
if (m_scene.IsSyncedServer())
|
||||
{
|
||||
m_scene.RegionSyncServerModule.SendTeleportUpdate(this);
|
||||
// this.PhysicsRequestingTerseUpdate();
|
||||
// m_scene.RegionSyncModule.QueueSceneObjectPartForUpdate(this);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endregion //REGION SYNC
|
||||
}
|
||||
}
|
||||
|
|
|
@ -128,6 +128,7 @@ public class PEScene : PhysicsScene
|
|||
if (actor.ChangingActorID == RegionSyncServerModule.ActorID && actor.lastValues.Changed(actor))
|
||||
{
|
||||
SceneToPhysEngineSyncServer.RouteUpdate(actor);
|
||||
actor.ChangingActorID = "YY";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue