From 03450dee39460f92d293621bb2fbcf93582397fc Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 27 Apr 2012 08:11:18 +0100 Subject: testing.... --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 39 +++++++++++++++--------- 1 file changed, 24 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 37196b0..32a17ce 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1099,27 +1099,36 @@ namespace OpenSim.Region.Framework.Scenes SendTerseUpdateToAllClients(); } - public void avnLocalTeleport(Vector3 newpos, Quaternion? newrot,Vector3? v, bool Stopit) + public void avnLocalTeleport(Vector3 newpos, Vector3? newvel, bool rotateToVelXY) { CheckLandingPoint(ref newpos); AbsolutePosition = newpos; - if (newrot.HasValue) + if (newvel.HasValue) { - // TODO - } + if (newvel == Vector3.Zero) + { + if (PhysicsActor != null) + PhysicsActor.SetMomentum(Vector3.Zero); + m_velocity = Vector3.Zero; + } + else + { + if (rotateToVelXY) + { + float x = ((Vector3)newvel).X; + float y = ((Vector3)newvel).Y; - if (v.HasValue) - { - if (PhysicsActor != null) - PhysicsActor.SetMomentum((Vector3)v); -// m_velocity = (Vector3)v; - } - else if (Stopit) - { - if (PhysicsActor != null) - PhysicsActor.SetMomentum(Vector3.Zero); - m_velocity = Vector3.Zero; + x = 0.5f * (float)Math.Atan2(y, x); + y = (float)Math.Cos(x); + x = (float)Math.Sin(x); + Rotation = new Quaternion(0f, 0f, x, y); + } + + if (PhysicsActor != null) + PhysicsActor.SetMomentum((Vector3)newvel); + m_velocity = (Vector3)newvel; + } } SendTerseUpdateToAllClients(); -- cgit v1.1