Allow setting a specific target velocity on TeleportWithMomentum

avinationmerge
Melanie 2012-04-18 22:16:59 +02:00
parent 5936e0c376
commit 411bd0574d
1 changed files with 11 additions and 1 deletions

View File

@ -1075,6 +1075,11 @@ namespace OpenSim.Region.Framework.Scenes
}
public void TeleportWithMomentum(Vector3 pos)
{
TeleportWithMomentum(pos, null);
}
public void TeleportWithMomentum(Vector3 pos, Vector3? v)
{
bool isFlying = Flying;
Vector3 vel = Velocity;
@ -1083,7 +1088,12 @@ namespace OpenSim.Region.Framework.Scenes
AbsolutePosition = pos;
AddToPhysicalScene(isFlying);
if (PhysicsActor != null)
PhysicsActor.SetMomentum(vel);
{
if (v.HasValue)
PhysicsActor.SetMomentum((Vector3)v);
else
PhysicsActor.SetMomentum(vel);
}
SendTerseUpdateToAllClients();
}