aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs')
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs22
1 files changed, 17 insertions, 5 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs b/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs
index 9d8f60d..83e12ba 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSAPIUnman.cs
@@ -339,10 +339,10 @@ public override bool DeleteCollisionShape(BulletWorld world, BulletShape shape)
339 return BSAPICPP.DeleteCollisionShape2(worldu.ptr, shapeu.ptr); 339 return BSAPICPP.DeleteCollisionShape2(worldu.ptr, shapeu.ptr);
340} 340}
341 341
342public override int GetBodyType(BulletBody obj) 342public override CollisionObjectTypes GetBodyType(BulletBody obj)
343{ 343{
344 BulletBodyUnman bodyu = obj as BulletBodyUnman; 344 BulletBodyUnman bodyu = obj as BulletBodyUnman;
345 return BSAPICPP.GetBodyType2(bodyu.ptr); 345 return (CollisionObjectTypes)BSAPICPP.GetBodyType2(bodyu.ptr);
346} 346}
347 347
348public override BulletBody CreateBodyFromShape(BulletWorld world, BulletShape shape, uint id, Vector3 pos, Quaternion rot) 348public override BulletBody CreateBodyFromShape(BulletWorld world, BulletShape shape, uint id, Vector3 pos, Quaternion rot)
@@ -522,9 +522,22 @@ public override void SetForceUpdateAllAabbs(BulletWorld world, bool force)
522// btDynamicsWorld entries 522// btDynamicsWorld entries
523public override bool AddObjectToWorld(BulletWorld world, BulletBody obj) 523public override bool AddObjectToWorld(BulletWorld world, BulletBody obj)
524{ 524{
525 // Bullet resets several variables when an object is added to the world.
526 // Gravity is reset to world default depending on the static/dynamic
527 // type. Of course, the collision flags in the broadphase proxy are initialized to default.
525 BulletWorldUnman worldu = world as BulletWorldUnman; 528 BulletWorldUnman worldu = world as BulletWorldUnman;
526 BulletBodyUnman bodyu = obj as BulletBodyUnman; 529 BulletBodyUnman bodyu = obj as BulletBodyUnman;
527 return BSAPICPP.AddObjectToWorld2(worldu.ptr, bodyu.ptr); 530
531 Vector3 origGrav = BSAPICPP.GetGravity2(bodyu.ptr);
532
533 bool ret = BSAPICPP.AddObjectToWorld2(worldu.ptr, bodyu.ptr);
534
535 if (ret)
536 {
537 BSAPICPP.SetGravity2(bodyu.ptr, origGrav);
538 obj.ApplyCollisionMask(world.physicsScene);
539 }
540 return ret;
528} 541}
529 542
530public override bool RemoveObjectFromWorld(BulletWorld world, BulletBody obj) 543public override bool RemoveObjectFromWorld(BulletWorld world, BulletBody obj)
@@ -1061,7 +1074,7 @@ public override Vector3 GetAngularFactor(BulletBody obj)
1061 return BSAPICPP.GetAngularFactor2(bodyu.ptr); 1074 return BSAPICPP.GetAngularFactor2(bodyu.ptr);
1062} 1075}
1063 1076
1064public override bool IsInWorld(BulletBody obj) 1077public override bool IsInWorld(BulletWorld world, BulletBody obj)
1065{ 1078{
1066 BulletBodyUnman bodyu = obj as BulletBodyUnman; 1079 BulletBodyUnman bodyu = obj as BulletBodyUnman;
1067 return BSAPICPP.IsInWorld2(bodyu.ptr); 1080 return BSAPICPP.IsInWorld2(bodyu.ptr);
@@ -1239,7 +1252,6 @@ public override void DumpPhysicsStatistics(BulletWorld world)
1239 BSAPICPP.DumpPhysicsStatistics2(worldu.ptr); 1252 BSAPICPP.DumpPhysicsStatistics2(worldu.ptr);
1240} 1253}
1241 1254
1242
1243// ===================================================================================== 1255// =====================================================================================
1244// ===================================================================================== 1256// =====================================================================================
1245// ===================================================================================== 1257// =====================================================================================