From 3a28f748d5cb586a5401b9b4d1f2f108af79ace1 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Tue, 12 May 2009 21:21:33 +0000 Subject: * Adds ScenePresence.TeleportWithMomentum - same as .Teleport, but preserves velocity. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 18 ++++++++++++++++++ .../OptionalModules/Scripting/Minimodule/SPAvatar.cs | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 8fd4b47..8950942 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1015,6 +1015,24 @@ namespace OpenSim.Region.Framework.Scenes SendTerseUpdateToAllClients(); } + public void TeleportWithMomentum(Vector3 pos) + { + bool isFlying = false; + if (m_physicsActor != null) + isFlying = m_physicsActor.Flying; + + RemoveFromPhysicalScene(); + AbsolutePosition = pos; + AddToPhysicalScene(isFlying); + if (m_appearance != null) + { + if (m_appearance.AvatarHeight > 0) + SetHeight(m_appearance.AvatarHeight); + } + + SendTerseUpdateToAllClients(); + } + /// /// /// diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs index 0f2076e..8fed89c 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs @@ -61,7 +61,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule public Vector3 WorldPosition { get { return GetSP().AbsolutePosition; } - set { GetSP().AbsolutePosition = value; } + set { GetSP().TeleportWithMomentum(value); } } } } -- cgit v1.1