diff options
author | Teravus Ovares | 2008-03-24 22:48:34 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-03-24 22:48:34 +0000 |
commit | dd6e6e7bdf3c7be8799fcf404a1e39df30f3e13d (patch) | |
tree | 54adaac374d9a2a9cce0d16bbc6c79b8153a1366 | |
parent | Implements llGetInventoryPermMask() (diff) | |
download | opensim-SC_OLD-dd6e6e7bdf3c7be8799fcf404a1e39df30f3e13d.zip opensim-SC_OLD-dd6e6e7bdf3c7be8799fcf404a1e39df30f3e13d.tar.gz opensim-SC_OLD-dd6e6e7bdf3c7be8799fcf404a1e39df30f3e13d.tar.bz2 opensim-SC_OLD-dd6e6e7bdf3c7be8799fcf404a1e39df30f3e13d.tar.xz |
* Added llApplyImpulse in the local frame.
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 24 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 20 |
2 files changed, 31 insertions, 13 deletions
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 | |||
560 | /// This is sent up to the group, which then finds the root prim | 560 | /// This is sent up to the group, which then finds the root prim |
561 | /// and applies the force on the root prim of the group | 561 | /// and applies the force on the root prim of the group |
562 | /// </summary> | 562 | /// </summary> |
563 | /// <param name="impulse">Vector force</param> | 563 | /// <param name="impulsei">Vector force</param> |
564 | public void ApplyImpulse(LLVector3 impulsei) | 564 | /// <param name="localGlobalTF">true for the local frame, false for the global frame</param> |
565 | public void ApplyImpulse(LLVector3 impulsei, bool localGlobalTF) | ||
565 | { | 566 | { |
566 | PhysicsVector impulse = new PhysicsVector(impulsei.X, impulsei.Y, impulsei.Z); | 567 | PhysicsVector impulse = new PhysicsVector(impulsei.X, impulsei.Y, impulsei.Z); |
567 | if (m_parentGroup != null) | 568 | |
569 | if (localGlobalTF) | ||
568 | { | 570 | { |
569 | m_parentGroup.applyImpulse(impulse); | 571 | |
572 | LLQuaternion grot = GetWorldRotation(); | ||
573 | Quaternion AXgrot = new Quaternion(grot.W,grot.X,grot.Y,grot.Z); | ||
574 | Vector3 AXimpulsei = new Vector3(impulsei.X, impulsei.Y, impulsei.Z); | ||
575 | Vector3 newimpulse = AXgrot * AXimpulsei; | ||
576 | impulse = new PhysicsVector(newimpulse.x, newimpulse.y, newimpulse.z); | ||
577 | |||
578 | } | ||
579 | else | ||
580 | { | ||
581 | |||
582 | if (m_parentGroup != null) | ||
583 | { | ||
584 | m_parentGroup.applyImpulse(impulse); | ||
585 | } | ||
570 | } | 586 | } |
571 | } | 587 | } |
572 | 588 | ||
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 499445a..82d67d4 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 | |||
1110 | { | 1110 | { |
1111 | m_host.AddScriptLPS(1); | 1111 | m_host.AddScriptLPS(1); |
1112 | //No energy force yet | 1112 | //No energy force yet |
1113 | |||
1114 | if (force.x > 20000) | ||
1115 | force.x = 20000; | ||
1116 | if (force.y > 20000) | ||
1117 | force.y = 20000; | ||
1118 | if (force.z > 20000) | ||
1119 | force.z = 20000; | ||
1120 | |||
1113 | if (local == 1) | 1121 | if (local == 1) |
1114 | { | 1122 | { |
1115 | NotImplemented("llApplyImpulse Local Force"); | 1123 | m_host.ApplyImpulse(new LLVector3((float)force.x, (float)force.y, (float)force.z), true); |
1116 | } | 1124 | } |
1117 | else | 1125 | else |
1118 | { | 1126 | { |
1119 | if (force.x > 20000) | 1127 | |
1120 | force.x = 20000; | 1128 | m_host.ApplyImpulse(new LLVector3((float)force.x,(float)force.y,(float)force.z), false); |
1121 | if (force.y > 20000) | ||
1122 | force.y = 20000; | ||
1123 | if (force.z > 20000) | ||
1124 | force.z = 20000; | ||
1125 | |||
1126 | m_host.ApplyImpulse(new LLVector3((float)force.x,(float)force.y,(float)force.z)); | ||
1127 | } | 1129 | } |
1128 | } | 1130 | } |
1129 | 1131 | ||