From 8ad6f575ebc23f0c7b282b9ec2543bce26287e54 Mon Sep 17 00:00:00 2001
From: Teravus Ovares
Date: Sun, 14 Dec 2008 14:30:28 +0000
Subject: * Implements the torque/Rotational Impulse methods in the PhysicsAPI
and the ODEPlugin and pipes them to their respective LSL method. * NBody will
need to be updated, this is an API change. Torque property and
AddAngularForce
---
.../Region/Environment/Scenes/SceneObjectPart.cs | 62 ++++++++++++++++++++++
1 file changed, 62 insertions(+)
(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 efc9289..5a43df6 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -1180,6 +1180,68 @@ if (m_shape != null) {
}
}
+
+ ///
+ /// hook to the physics scene to apply angular impulse
+ /// 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
+ /// true for the local frame, false for the global frame
+ public void ApplyAngularImpulse(Vector3 impulsei, bool localGlobalTF)
+ {
+ PhysicsVector impulse = new PhysicsVector(impulsei.X, impulsei.Y, impulsei.Z);
+
+ if (localGlobalTF)
+ {
+ Quaternion grot = GetWorldRotation();
+ Quaternion AXgrot = grot;
+ Vector3 AXimpulsei = impulsei;
+ Vector3 newimpulse = AXimpulsei * AXgrot;
+ impulse = new PhysicsVector(newimpulse.X, newimpulse.Y, newimpulse.Z);
+ }
+
+ if (m_parentGroup != null)
+ {
+ m_parentGroup.applyAngularImpulse(impulse);
+ }
+ }
+
+ ///
+ /// hook to the physics scene to apply angular impulse
+ /// 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
+ /// true for the local frame, false for the global frame
+ public void SetAngularImpulse(Vector3 impulsei, bool localGlobalTF)
+ {
+ PhysicsVector impulse = new PhysicsVector(impulsei.X, impulsei.Y, impulsei.Z);
+
+ if (localGlobalTF)
+ {
+ Quaternion grot = GetWorldRotation();
+ Quaternion AXgrot = grot;
+ Vector3 AXimpulsei = impulsei;
+ Vector3 newimpulse = AXimpulsei * AXgrot;
+ impulse = new PhysicsVector(newimpulse.X, newimpulse.Y, newimpulse.Z);
+ }
+
+ if (m_parentGroup != null)
+ {
+ m_parentGroup.setAngularImpulse(impulse);
+ }
+ }
+
+ public Vector3 GetTorque()
+ {
+ if (m_parentGroup != null)
+ {
+ m_parentGroup.GetTorque();
+ }
+ return Vector3.Zero;
+ }
+
///
/// Apply physics to this part.
///
--
cgit v1.1