diff options
author | Teravus Ovares | 2008-12-14 14:30:28 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-12-14 14:30:28 +0000 |
commit | 8ad6f575ebc23f0c7b282b9ec2543bce26287e54 (patch) | |
tree | ab424abb19a070cce386a5013b3d5452dbdf9bc2 /OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |
parent | Added ATTACH_HUD_* constants fixes Mantis #2823 (diff) | |
download | opensim-SC-8ad6f575ebc23f0c7b282b9ec2543bce26287e54.zip opensim-SC-8ad6f575ebc23f0c7b282b9ec2543bce26287e54.tar.gz opensim-SC-8ad6f575ebc23f0c7b282b9ec2543bce26287e54.tar.bz2 opensim-SC-8ad6f575ebc23f0c7b282b9ec2543bce26287e54.tar.xz |
* 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
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | 62 |
1 files changed, 62 insertions, 0 deletions
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) { | |||
1180 | } | 1180 | } |
1181 | } | 1181 | } |
1182 | 1182 | ||
1183 | |||
1184 | /// <summary> | ||
1185 | /// hook to the physics scene to apply angular impulse | ||
1186 | /// This is sent up to the group, which then finds the root prim | ||
1187 | /// and applies the force on the root prim of the group | ||
1188 | /// </summary> | ||
1189 | /// <param name="impulsei">Vector force</param> | ||
1190 | /// <param name="localGlobalTF">true for the local frame, false for the global frame</param> | ||
1191 | public void ApplyAngularImpulse(Vector3 impulsei, bool localGlobalTF) | ||
1192 | { | ||
1193 | PhysicsVector impulse = new PhysicsVector(impulsei.X, impulsei.Y, impulsei.Z); | ||
1194 | |||
1195 | if (localGlobalTF) | ||
1196 | { | ||
1197 | Quaternion grot = GetWorldRotation(); | ||
1198 | Quaternion AXgrot = grot; | ||
1199 | Vector3 AXimpulsei = impulsei; | ||
1200 | Vector3 newimpulse = AXimpulsei * AXgrot; | ||
1201 | impulse = new PhysicsVector(newimpulse.X, newimpulse.Y, newimpulse.Z); | ||
1202 | } | ||
1203 | |||
1204 | if (m_parentGroup != null) | ||
1205 | { | ||
1206 | m_parentGroup.applyAngularImpulse(impulse); | ||
1207 | } | ||
1208 | } | ||
1209 | |||
1210 | /// <summary> | ||
1211 | /// hook to the physics scene to apply angular impulse | ||
1212 | /// This is sent up to the group, which then finds the root prim | ||
1213 | /// and applies the force on the root prim of the group | ||
1214 | /// </summary> | ||
1215 | /// <param name="impulsei">Vector force</param> | ||
1216 | /// <param name="localGlobalTF">true for the local frame, false for the global frame</param> | ||
1217 | public void SetAngularImpulse(Vector3 impulsei, bool localGlobalTF) | ||
1218 | { | ||
1219 | PhysicsVector impulse = new PhysicsVector(impulsei.X, impulsei.Y, impulsei.Z); | ||
1220 | |||
1221 | if (localGlobalTF) | ||
1222 | { | ||
1223 | Quaternion grot = GetWorldRotation(); | ||
1224 | Quaternion AXgrot = grot; | ||
1225 | Vector3 AXimpulsei = impulsei; | ||
1226 | Vector3 newimpulse = AXimpulsei * AXgrot; | ||
1227 | impulse = new PhysicsVector(newimpulse.X, newimpulse.Y, newimpulse.Z); | ||
1228 | } | ||
1229 | |||
1230 | if (m_parentGroup != null) | ||
1231 | { | ||
1232 | m_parentGroup.setAngularImpulse(impulse); | ||
1233 | } | ||
1234 | } | ||
1235 | |||
1236 | public Vector3 GetTorque() | ||
1237 | { | ||
1238 | if (m_parentGroup != null) | ||
1239 | { | ||
1240 | m_parentGroup.GetTorque(); | ||
1241 | } | ||
1242 | return Vector3.Zero; | ||
1243 | } | ||
1244 | |||
1183 | /// <summary> | 1245 | /// <summary> |
1184 | /// Apply physics to this part. | 1246 | /// Apply physics to this part. |
1185 | /// </summary> | 1247 | /// </summary> |