diff options
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs b/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs index 8c6e7d6..14de2eb 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs | |||
@@ -530,12 +530,12 @@ public override void SetForceUpdateAllAabbs(BulletWorld world, bool force) | |||
530 | // btDynamicsWorld entries | 530 | // btDynamicsWorld entries |
531 | public override bool AddObjectToWorld(BulletWorld world, BulletBody obj) | 531 | public override bool AddObjectToWorld(BulletWorld world, BulletBody obj) |
532 | { | 532 | { |
533 | // Bullet resets several variables when an object is added to the world. | ||
534 | // Gravity is reset to world default depending on the static/dynamic | ||
535 | // type. Of course, the collision flags in the broadphase proxy are initialized to default. | ||
536 | BulletWorldUnman worldu = world as BulletWorldUnman; | 533 | BulletWorldUnman worldu = world as BulletWorldUnman; |
537 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | 534 | BulletBodyUnman bodyu = obj as BulletBodyUnman; |
538 | 535 | ||
536 | // Bullet resets several variables when an object is added to the world. | ||
537 | // Gravity is reset to world default depending on the static/dynamic | ||
538 | // type. Of course, the collision flags in the broadphase proxy are initialized to default. | ||
539 | Vector3 origGrav = BSAPICPP.GetGravity2(bodyu.ptr); | 539 | Vector3 origGrav = BSAPICPP.GetGravity2(bodyu.ptr); |
540 | 540 | ||
541 | bool ret = BSAPICPP.AddObjectToWorld2(worldu.ptr, bodyu.ptr); | 541 | bool ret = BSAPICPP.AddObjectToWorld2(worldu.ptr, bodyu.ptr); |
@@ -921,6 +921,7 @@ public override void SetCenterOfMassByPosRot(BulletBody obj, Vector3 pos, Quater | |||
921 | } | 921 | } |
922 | 922 | ||
923 | // Add a force to the object as if its mass is one. | 923 | // Add a force to the object as if its mass is one. |
924 | // Deep down in Bullet: m_totalForce += force*m_linearFactor; | ||
924 | public override void ApplyCentralForce(BulletBody obj, Vector3 force) | 925 | public override void ApplyCentralForce(BulletBody obj, Vector3 force) |
925 | { | 926 | { |
926 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | 927 | BulletBodyUnman bodyu = obj as BulletBodyUnman; |
@@ -964,6 +965,7 @@ public override void SetSleepingThresholds(BulletBody obj, float lin_threshold, | |||
964 | BSAPICPP.SetSleepingThresholds2(bodyu.ptr, lin_threshold, ang_threshold); | 965 | BSAPICPP.SetSleepingThresholds2(bodyu.ptr, lin_threshold, ang_threshold); |
965 | } | 966 | } |
966 | 967 | ||
968 | // Deep down in Bullet: m_totalTorque += torque*m_angularFactor; | ||
967 | public override void ApplyTorque(BulletBody obj, Vector3 torque) | 969 | public override void ApplyTorque(BulletBody obj, Vector3 torque) |
968 | { | 970 | { |
969 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | 971 | BulletBodyUnman bodyu = obj as BulletBodyUnman; |
@@ -971,6 +973,8 @@ public override void ApplyTorque(BulletBody obj, Vector3 torque) | |||
971 | } | 973 | } |
972 | 974 | ||
973 | // Apply force at the given point. Will add torque to the object. | 975 | // Apply force at the given point. Will add torque to the object. |
976 | // Deep down in Bullet: applyCentralForce(force); | ||
977 | // applyTorque(rel_pos.cross(force*m_linearFactor)); | ||
974 | public override void ApplyForce(BulletBody obj, Vector3 force, Vector3 pos) | 978 | public override void ApplyForce(BulletBody obj, Vector3 force, Vector3 pos) |
975 | { | 979 | { |
976 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | 980 | BulletBodyUnman bodyu = obj as BulletBodyUnman; |
@@ -978,6 +982,7 @@ public override void ApplyForce(BulletBody obj, Vector3 force, Vector3 pos) | |||
978 | } | 982 | } |
979 | 983 | ||
980 | // Apply impulse to the object. Same as "ApplycentralForce" but force scaled by object's mass. | 984 | // Apply impulse to the object. Same as "ApplycentralForce" but force scaled by object's mass. |
985 | // Deep down in Bullet: m_linearVelocity += impulse *m_linearFactor * m_inverseMass; | ||
981 | public override void ApplyCentralImpulse(BulletBody obj, Vector3 imp) | 986 | public override void ApplyCentralImpulse(BulletBody obj, Vector3 imp) |
982 | { | 987 | { |
983 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | 988 | BulletBodyUnman bodyu = obj as BulletBodyUnman; |
@@ -985,6 +990,7 @@ public override void ApplyCentralImpulse(BulletBody obj, Vector3 imp) | |||
985 | } | 990 | } |
986 | 991 | ||
987 | // Apply impulse to the object's torque. Force is scaled by object's mass. | 992 | // Apply impulse to the object's torque. Force is scaled by object's mass. |
993 | // Deep down in Bullet: m_angularVelocity += m_invInertiaTensorWorld * torque * m_angularFactor; | ||
988 | public override void ApplyTorqueImpulse(BulletBody obj, Vector3 imp) | 994 | public override void ApplyTorqueImpulse(BulletBody obj, Vector3 imp) |
989 | { | 995 | { |
990 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | 996 | BulletBodyUnman bodyu = obj as BulletBodyUnman; |
@@ -992,6 +998,8 @@ public override void ApplyTorqueImpulse(BulletBody obj, Vector3 imp) | |||
992 | } | 998 | } |
993 | 999 | ||
994 | // Apply impulse at the point given. For is scaled by object's mass and effects both linear and angular forces. | 1000 | // Apply impulse at the point given. For is scaled by object's mass and effects both linear and angular forces. |
1001 | // Deep down in Bullet: applyCentralImpulse(impulse); | ||
1002 | // applyTorqueImpulse(rel_pos.cross(impulse*m_linearFactor)); | ||
995 | public override void ApplyImpulse(BulletBody obj, Vector3 imp, Vector3 pos) | 1003 | public override void ApplyImpulse(BulletBody obj, Vector3 imp, Vector3 pos) |
996 | { | 1004 | { |
997 | BulletBodyUnman bodyu = obj as BulletBodyUnman; | 1005 | BulletBodyUnman bodyu = obj as BulletBodyUnman; |
@@ -1259,6 +1267,16 @@ public override void DumpPhysicsStatistics(BulletWorld world) | |||
1259 | BulletWorldUnman worldu = world as BulletWorldUnman; | 1267 | BulletWorldUnman worldu = world as BulletWorldUnman; |
1260 | BSAPICPP.DumpPhysicsStatistics2(worldu.ptr); | 1268 | BSAPICPP.DumpPhysicsStatistics2(worldu.ptr); |
1261 | } | 1269 | } |
1270 | public override void ResetBroadphasePool(BulletWorld world) | ||
1271 | { | ||
1272 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
1273 | BSAPICPP.ResetBroadphasePool(worldu.ptr); | ||
1274 | } | ||
1275 | public override void ResetConstraintSolver(BulletWorld world) | ||
1276 | { | ||
1277 | BulletWorldUnman worldu = world as BulletWorldUnman; | ||
1278 | BSAPICPP.ResetConstraintSolver(worldu.ptr); | ||
1279 | } | ||
1262 | 1280 | ||
1263 | // ===================================================================================== | 1281 | // ===================================================================================== |
1264 | // ===================================================================================== | 1282 | // ===================================================================================== |
@@ -1832,6 +1850,12 @@ public static extern void DumpAllInfo2(IntPtr sim); | |||
1832 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | 1850 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] |
1833 | public static extern void DumpPhysicsStatistics2(IntPtr sim); | 1851 | public static extern void DumpPhysicsStatistics2(IntPtr sim); |
1834 | 1852 | ||
1853 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1854 | public static extern void ResetBroadphasePool(IntPtr sim); | ||
1855 | |||
1856 | [DllImport("BulletSim", CallingConvention = CallingConvention.Cdecl), SuppressUnmanagedCodeSecurity] | ||
1857 | public static extern void ResetConstraintSolver(IntPtr sim); | ||
1858 | |||
1835 | } | 1859 | } |
1836 | 1860 | ||
1837 | } | 1861 | } |