mirror of
https://github.com/opensim/opensim.git
synced 2026-08-11 03:45:35 +08:00
add osLocalTeleportAgent(key agent, vector position, vector velocity, vector lookat, LSL_Integer flags). Velocity only works with ubOde but still not good. flags = bit field: 1 use velocity, 2 use lookat, 4 rotate avatar look in current velocity direction (ignored if 2 ie flag = 7 is same as 3). This bypasses most the unnecessary logic of osTeleportAgent, having usage same permissions. It may do region crossings(?). Experimental stage, feedbakc expected ;)
This commit is contained in:
@@ -4795,6 +4795,20 @@ Label_GroupsDone:
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Tries to teleport agent within region.
|
||||
/// </summary>
|
||||
/// <param name="remoteClient"></param>
|
||||
/// <param name="position"></param>
|
||||
/// <param name="lookAt"></param>
|
||||
/// <param name="teleportFlags"></param>
|
||||
public void RequestLocalTeleport(ScenePresence sp, Vector3 position, Vector3 vel,
|
||||
Vector3 lookat, int flags)
|
||||
{
|
||||
sp.LocalTeleport(position, vel, lookat, flags);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tries to teleport agent to another region.
|
||||
/// </summary>
|
||||
|
||||
@@ -1688,10 +1688,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
// }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Do not call this directly. Call Scene.RequestTeleportLocation() instead.
|
||||
/// </summary>
|
||||
/// <param name="pos"></param>
|
||||
public void Teleport(Vector3 pos)
|
||||
{
|
||||
TeleportWithMomentum(pos, Vector3.Zero);
|
||||
@@ -1736,36 +1732,37 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
SendTerseUpdateToAllClients();
|
||||
}
|
||||
|
||||
public void avnLocalTeleport(Vector3 newpos, Vector3? newvel, bool rotateToVelXY)
|
||||
public void LocalTeleport(Vector3 newpos, Vector3 newvel, Vector3 newlookat, int flags)
|
||||
{
|
||||
if(!CheckLocalTPLandingPoint(ref newpos))
|
||||
return;
|
||||
|
||||
AbsolutePosition = newpos;
|
||||
|
||||
if (newvel.HasValue)
|
||||
if ((flags & 1) != 0)
|
||||
{
|
||||
if ((Vector3)newvel == Vector3.Zero)
|
||||
{
|
||||
if (PhysicsActor != null)
|
||||
PhysicsActor.SetMomentum(Vector3.Zero);
|
||||
m_velocity = Vector3.Zero;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (PhysicsActor != null)
|
||||
PhysicsActor.SetMomentum((Vector3)newvel);
|
||||
m_velocity = (Vector3)newvel;
|
||||
if (PhysicsActor != null)
|
||||
PhysicsActor.SetMomentum(newvel);
|
||||
m_velocity = newvel;
|
||||
}
|
||||
|
||||
if (rotateToVelXY)
|
||||
{
|
||||
Vector3 lookAt = (Vector3)newvel;
|
||||
lookAt.Z = 0;
|
||||
lookAt.Normalize();
|
||||
ControllingClient.SendLocalTeleport(newpos, lookAt, (uint)TeleportFlags.ViaLocation);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if ((flags & 2) != 0)
|
||||
{
|
||||
newlookat.Z = 0;
|
||||
newlookat.Normalize();
|
||||
if (Math.Abs(newlookat.X) > 0.001 || Math.Abs(newlookat.Y) > 0.001)
|
||||
ControllingClient.SendLocalTeleport(newpos, newlookat, (uint)TeleportFlags.ViaLocation);
|
||||
}
|
||||
else if((flags & 4) != 0)
|
||||
{
|
||||
if((flags & 1) != 0)
|
||||
newlookat = newvel;
|
||||
else
|
||||
newlookat = m_velocity;
|
||||
newlookat.Z = 0;
|
||||
newlookat.Normalize();
|
||||
if (Math.Abs(newlookat.X) > 0.001 || Math.Abs(newlookat.Y) > 0.001)
|
||||
ControllingClient.SendLocalTeleport(newpos, newlookat, (uint)TeleportFlags.ViaLocation);
|
||||
}
|
||||
SendTerseUpdateToAllClients();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user