diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 2fa92b3394..073d11f206 100755
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -4795,6 +4795,20 @@ Label_GroupsDone:
return true;
}
+
+ ///
+ /// Tries to teleport agent within region.
+ ///
+ ///
+ ///
+ ///
+ ///
+ public void RequestLocalTeleport(ScenePresence sp, Vector3 position, Vector3 vel,
+ Vector3 lookat, int flags)
+ {
+ sp.LocalTeleport(position, vel, lookat, flags);
+ }
+
///
/// Tries to teleport agent to another region.
///
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index b341d48bb4..56e822af4b 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1688,10 +1688,6 @@ namespace OpenSim.Region.Framework.Scenes
// }
}
- ///
- /// Do not call this directly. Call Scene.RequestTeleportLocation() instead.
- ///
- ///
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();
}
diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs
index 267fc5b458..cec8b742a7 100644
--- a/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs
+++ b/OpenSim/Region/PhysicsModules/ubOde/ODECharacter.cs
@@ -1976,8 +1976,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
private void changeTargetVelocity(Vector3 newVel)
{
- m_pidControllerActive = true;
- m_freemove = false;
+ //m_pidControllerActive = true;
+ //m_freemove = false;
_target_velocity = newVel;
if (Body != IntPtr.Zero)
SafeNativeMethods.BodyEnable(Body);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index c1c1eafe2e..a0f784e667 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -924,6 +924,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
// 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)
{
// High because there is no security check. High griefer potential
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index ce6aaf8852..194df36fec 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -150,6 +150,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
string osGetAgentIP(string agent);
// 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, int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
void osTeleportAgent(string agent, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index fd5142f71c..88ea9d5660 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -247,6 +247,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
// 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)
{
m_OSSL_Functions.osTeleportAgent(agent, regionName, position, lookat);