diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index b2ba70cc5b..48177dc5f1 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -560,13 +560,29 @@ namespace OpenSim.Region.Environment.Scenes
/// This is sent up to the group, which then finds the root prim
/// and applies the force on the root prim of the group
///
- /// Vector force
- public void ApplyImpulse(LLVector3 impulsei)
+ /// Vector force
+ /// true for the local frame, false for the global frame
+ public void ApplyImpulse(LLVector3 impulsei, bool localGlobalTF)
{
PhysicsVector impulse = new PhysicsVector(impulsei.X, impulsei.Y, impulsei.Z);
- if (m_parentGroup != null)
+
+ if (localGlobalTF)
{
- m_parentGroup.applyImpulse(impulse);
+
+ LLQuaternion grot = GetWorldRotation();
+ Quaternion AXgrot = new Quaternion(grot.W,grot.X,grot.Y,grot.Z);
+ Vector3 AXimpulsei = new Vector3(impulsei.X, impulsei.Y, impulsei.Z);
+ Vector3 newimpulse = AXgrot * AXimpulsei;
+ impulse = new PhysicsVector(newimpulse.x, newimpulse.y, newimpulse.z);
+
+ }
+ else
+ {
+
+ if (m_parentGroup != null)
+ {
+ m_parentGroup.applyImpulse(impulse);
+ }
}
}
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
index 499445a72e..82d67d4fbd 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
@@ -1110,20 +1110,22 @@ namespace OpenSim.Region.ScriptEngine.Common
{
m_host.AddScriptLPS(1);
//No energy force yet
+
+ if (force.x > 20000)
+ force.x = 20000;
+ if (force.y > 20000)
+ force.y = 20000;
+ if (force.z > 20000)
+ force.z = 20000;
+
if (local == 1)
{
- NotImplemented("llApplyImpulse Local Force");
+ m_host.ApplyImpulse(new LLVector3((float)force.x, (float)force.y, (float)force.z), true);
}
else
{
- if (force.x > 20000)
- force.x = 20000;
- if (force.y > 20000)
- force.y = 20000;
- if (force.z > 20000)
- force.z = 20000;
-
- m_host.ApplyImpulse(new LLVector3((float)force.x,(float)force.y,(float)force.z));
+
+ m_host.ApplyImpulse(new LLVector3((float)force.x,(float)force.y,(float)force.z), false);
}
}