diff options
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 39 |
1 files changed, 24 insertions, 15 deletions
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 | |||
1099 | SendTerseUpdateToAllClients(); | 1099 | SendTerseUpdateToAllClients(); |
1100 | } | 1100 | } |
1101 | 1101 | ||
1102 | public void avnLocalTeleport(Vector3 newpos, Quaternion? newrot,Vector3? v, bool Stopit) | 1102 | public void avnLocalTeleport(Vector3 newpos, Vector3? newvel, bool rotateToVelXY) |
1103 | { | 1103 | { |
1104 | CheckLandingPoint(ref newpos); | 1104 | CheckLandingPoint(ref newpos); |
1105 | AbsolutePosition = newpos; | 1105 | AbsolutePosition = newpos; |
1106 | 1106 | ||
1107 | if (newrot.HasValue) | 1107 | if (newvel.HasValue) |
1108 | { | 1108 | { |
1109 | // TODO | 1109 | if (newvel == Vector3.Zero) |
1110 | } | 1110 | { |
1111 | if (PhysicsActor != null) | ||
1112 | PhysicsActor.SetMomentum(Vector3.Zero); | ||
1113 | m_velocity = Vector3.Zero; | ||
1114 | } | ||
1115 | else | ||
1116 | { | ||
1117 | if (rotateToVelXY) | ||
1118 | { | ||
1119 | float x = ((Vector3)newvel).X; | ||
1120 | float y = ((Vector3)newvel).Y; | ||
1111 | 1121 | ||
1112 | if (v.HasValue) | 1122 | x = 0.5f * (float)Math.Atan2(y, x); |
1113 | { | 1123 | y = (float)Math.Cos(x); |
1114 | if (PhysicsActor != null) | 1124 | x = (float)Math.Sin(x); |
1115 | PhysicsActor.SetMomentum((Vector3)v); | 1125 | Rotation = new Quaternion(0f, 0f, x, y); |
1116 | // m_velocity = (Vector3)v; | 1126 | } |
1117 | } | 1127 | |
1118 | else if (Stopit) | 1128 | if (PhysicsActor != null) |
1119 | { | 1129 | PhysicsActor.SetMomentum((Vector3)newvel); |
1120 | if (PhysicsActor != null) | 1130 | m_velocity = (Vector3)newvel; |
1121 | PhysicsActor.SetMomentum(Vector3.Zero); | 1131 | } |
1122 | m_velocity = Vector3.Zero; | ||
1123 | } | 1132 | } |
1124 | 1133 | ||
1125 | SendTerseUpdateToAllClients(); | 1134 | SendTerseUpdateToAllClients(); |