From dd6e6e7bdf3c7be8799fcf404a1e39df30f3e13d Mon Sep 17 00:00:00 2001
From: Teravus Ovares
Date: Mon, 24 Mar 2008 22:48:34 +0000
Subject: * Added llApplyImpulse in the local frame.
---
.../Region/Environment/Scenes/SceneObjectPart.cs | 24 ++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Region/Environment/Scenes/SceneObjectPart.cs')
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index b2ba70c..48177dc 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);
+ }
}
}
--
cgit v1.1