Browse Source

Exposed flag to disable collision between linked bodies.

enn0x 10 years ago
parent
commit
b7ef0d3bc3
2 changed files with 7 additions and 5 deletions
  1. 5 4
      panda/src/bullet/bulletWorld.cxx
  2. 2 1
      panda/src/bullet/bulletWorld.h

+ 5 - 4
panda/src/bullet/bulletWorld.cxx

@@ -608,11 +608,12 @@ remove_vehicle(BulletVehicle *vehicle) {
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: BulletWorld::attach_constraint
 //     Function: BulletWorld::attach_constraint
 //       Access: Published
 //       Access: Published
-//  Description: Deprecated!
-//               Please use BulletWorld::attach
+//  Description: Attaches a single constraint to a world. Collision
+//               checks between the linked objects will be disabled
+//               if the second parameter is set to TRUE.
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 void BulletWorld::
 void BulletWorld::
-attach_constraint(BulletConstraint *constraint) {
+attach_constraint(BulletConstraint *constraint, bool linked_collision) {
 
 
   nassertv(constraint);
   nassertv(constraint);
 
 
@@ -622,7 +623,7 @@ attach_constraint(BulletConstraint *constraint) {
 
 
   if (found == _constraints.end()) {
   if (found == _constraints.end()) {
     _constraints.push_back(constraint);
     _constraints.push_back(constraint);
-    _world->addConstraint(constraint->ptr());
+    _world->addConstraint(constraint->ptr(), linked_collision);
   }
   }
   else {
   else {
     bullet_cat.warning() << "constraint already attached" << endl;
     bullet_cat.warning() << "constraint already attached" << endl;

+ 2 - 1
panda/src/bullet/bulletWorld.h

@@ -70,6 +70,8 @@ PUBLISHED:
 
 
   // Attach/Remove
   // Attach/Remove
   void attach(TypedObject *object);
   void attach(TypedObject *object);
+  void attach_constraint(BulletConstraint *constraint, bool linked_collision=false);
+
   void remove(TypedObject *object);
   void remove(TypedObject *object);
 
 
   // Ghost object
   // Ghost object
@@ -172,7 +174,6 @@ PUBLISHED: // Deprecated methods, will become private soon
   void attach_character(BulletBaseCharacterControllerNode *node);
   void attach_character(BulletBaseCharacterControllerNode *node);
   void remove_character(BulletBaseCharacterControllerNode *node);
   void remove_character(BulletBaseCharacterControllerNode *node);
 
 
-  void attach_constraint(BulletConstraint *constraint);
   void remove_constraint(BulletConstraint *constraint);
   void remove_constraint(BulletConstraint *constraint);
 
 
 public:
 public: