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 ;)
parent
9225b78309
commit
11c945a565
|
@ -4795,6 +4795,20 @@ Label_GroupsDone:
|
||||||
return true;
|
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>
|
/// <summary>
|
||||||
/// Tries to teleport agent to another region.
|
/// Tries to teleport agent to another region.
|
||||||
/// </summary>
|
/// </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)
|
public void Teleport(Vector3 pos)
|
||||||
{
|
{
|
||||||
TeleportWithMomentum(pos, Vector3.Zero);
|
TeleportWithMomentum(pos, Vector3.Zero);
|
||||||
|
@ -1736,36 +1732,37 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
SendTerseUpdateToAllClients();
|
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))
|
if(!CheckLocalTPLandingPoint(ref newpos))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
AbsolutePosition = newpos;
|
AbsolutePosition = newpos;
|
||||||
|
|
||||||
if (newvel.HasValue)
|
if ((flags & 1) != 0)
|
||||||
{
|
{
|
||||||
if ((Vector3)newvel == Vector3.Zero)
|
if (PhysicsActor != null)
|
||||||
{
|
PhysicsActor.SetMomentum(newvel);
|
||||||
if (PhysicsActor != null)
|
m_velocity = newvel;
|
||||||
PhysicsActor.SetMomentum(Vector3.Zero);
|
}
|
||||||
m_velocity = Vector3.Zero;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (PhysicsActor != null)
|
|
||||||
PhysicsActor.SetMomentum((Vector3)newvel);
|
|
||||||
m_velocity = (Vector3)newvel;
|
|
||||||
|
|
||||||
if (rotateToVelXY)
|
if ((flags & 2) != 0)
|
||||||
{
|
{
|
||||||
Vector3 lookAt = (Vector3)newvel;
|
newlookat.Z = 0;
|
||||||
lookAt.Z = 0;
|
newlookat.Normalize();
|
||||||
lookAt.Normalize();
|
if (Math.Abs(newlookat.X) > 0.001 || Math.Abs(newlookat.Y) > 0.001)
|
||||||
ControllingClient.SendLocalTeleport(newpos, lookAt, (uint)TeleportFlags.ViaLocation);
|
ControllingClient.SendLocalTeleport(newpos, newlookat, (uint)TeleportFlags.ViaLocation);
|
||||||
return;
|
}
|
||||||
}
|
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();
|
SendTerseUpdateToAllClients();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1976,8 +1976,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
|
||||||
|
|
||||||
private void changeTargetVelocity(Vector3 newVel)
|
private void changeTargetVelocity(Vector3 newVel)
|
||||||
{
|
{
|
||||||
m_pidControllerActive = true;
|
//m_pidControllerActive = true;
|
||||||
m_freemove = false;
|
//m_freemove = false;
|
||||||
_target_velocity = newVel;
|
_target_velocity = newVel;
|
||||||
if (Body != IntPtr.Zero)
|
if (Body != IntPtr.Zero)
|
||||||
SafeNativeMethods.BodyEnable(Body);
|
SafeNativeMethods.BodyEnable(Body);
|
||||||
|
|
|
@ -924,6 +924,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
|
|
||||||
// Teleport functions
|
// Teleport functions
|
||||||
|
public void osLocalTeleportAgent(LSL_Key agent, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity, LSL_Types.Vector3 lookat, LSL_Integer flags)
|
||||||
|
{
|
||||||
|
UUID agentId;
|
||||||
|
if (!UUID.TryParse(agent, out agentId))
|
||||||
|
return;
|
||||||
|
|
||||||
|
ScenePresence presence = World.GetScenePresence(agentId);
|
||||||
|
if (presence == null || presence.IsDeleted || presence.IsInTransit)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Vector3 pos = presence.AbsolutePosition;
|
||||||
|
if (!checkAllowAgentTPbyLandOwner(agentId, pos))
|
||||||
|
return;
|
||||||
|
|
||||||
|
World.RequestLocalTeleport(presence, position, velocity, lookat, flags);
|
||||||
|
}
|
||||||
|
|
||||||
public void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
|
public void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat)
|
||||||
{
|
{
|
||||||
// High because there is no security check. High griefer potential
|
// High because there is no security check. High griefer potential
|
||||||
|
|
|
@ -150,6 +150,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||||
string osGetAgentIP(string agent);
|
string osGetAgentIP(string agent);
|
||||||
|
|
||||||
// Teleport commands
|
// Teleport commands
|
||||||
|
void osLocalTeleportAgent(LSL_Key agent, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity, LSL_Types.Vector3 lookat, LSL_Integer flags);
|
||||||
void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
|
void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
|
||||||
void osTeleportAgent(string agent, int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
|
void osTeleportAgent(string agent, int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
|
||||||
void osTeleportAgent(string agent, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
|
void osTeleportAgent(string agent, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
|
||||||
|
|
|
@ -247,6 +247,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||||
|
|
||||||
// Teleport Functions
|
// Teleport Functions
|
||||||
|
|
||||||
|
public void osLocalTeleportAgent(LSL_Key agent, vector position, vector velocity, vector lookat, LSL_Integer flags)
|
||||||
|
{
|
||||||
|
m_OSSL_Functions.osLocalTeleportAgent(agent, position, velocity, lookat, flags);
|
||||||
|
}
|
||||||
|
|
||||||
public void osTeleportAgent(string agent, string regionName, vector position, vector lookat)
|
public void osTeleportAgent(string agent, string regionName, vector position, vector lookat)
|
||||||
{
|
{
|
||||||
m_OSSL_Functions.osTeleportAgent(agent, regionName, position, lookat);
|
m_OSSL_Functions.osTeleportAgent(agent, regionName, position, lookat);
|
||||||
|
|
Loading…
Reference in New Issue