disable /enable a join

dgu123
Posts: 2
Joined: Thu Jan 03, 2013 3:36 pm

disable /enable a join

Post by dgu123 »

Dear Team

i am quite new in bullet (i come from ODE) and i would like to know how to disable or enable a hinge join without having to destroy it ???
removeConstraint from the dynamic world work but is there other way?
KInd regards
david
Last edited by dgu123 on Thu Jan 03, 2013 3:49 pm, edited 1 time in total.
cgripeos
Posts: 20
Joined: Mon Sep 24, 2007 5:45 am

Re: disable /enable a join

Post by cgripeos »

You can add it and remove it from the physics world using

btDynamicsWorld::addConstraint(btTypedConstraint);
btDynamicsWorld::removeConstraint(btTypedConstraint);

Or (once its added to the simulation) you can enable/disable it using

btTypedConstraint::setEnabled(bool)
dgu123
Posts: 2
Joined: Thu Jan 03, 2013 3:36 pm

Re: disable /enable a join

Post by dgu123 »

thank you very much for yur help !!

regards
david
cgripeos
Posts: 20
Joined: Mon Sep 24, 2007 5:45 am

Re: disable /enable a join

Post by cgripeos »

One funny about Bullet when switching from another Physics Engine is that if the btRigidBody (that the btConstraint is targeting) is not already in the physics world, when activating the constraint Bullet might crash.

So you have to add your RBs first before adding constraints to the btDynamicsWorld.

Just a heads up.