turning on and off one constraint
Posted: Thu Jun 11, 2015 5:50 pm
Hello everyone!
I am trying enabling and disabling a constraint so that I can enable it when a collision happens and disable it when the collision ends.
what better way to do this ?
I'm trying something like this:
if(colisao){ //creates a constraint
sphete.getBasis().setEulerZYX(0, SIMD_HALF_PI, 0);
palma.setOrigin(btVector3(0, 20, 12));
joitn6DOF = new btGeneric6DofConstraint(*bodySphere, *bodyPalma, sphere, palma, false);
world->addConstraint(join6DOF, true);
}else{ //When the collision ends
/* Delete constraint */
}
But the sphere and the hand do not been together when the collision happens. The sphere is spinning all the time and the constraint does not work...
Please someone helps me!
Thanks!
I am trying enabling and disabling a constraint so that I can enable it when a collision happens and disable it when the collision ends.
what better way to do this ?
I'm trying something like this:
if(colisao){ //creates a constraint
sphete.getBasis().setEulerZYX(0, SIMD_HALF_PI, 0);
palma.setOrigin(btVector3(0, 20, 12));
joitn6DOF = new btGeneric6DofConstraint(*bodySphere, *bodyPalma, sphere, palma, false);
world->addConstraint(join6DOF, true);
}else{ //When the collision ends
/* Delete constraint */
}
But the sphere and the hand do not been together when the collision happens. The sphere is spinning all the time and the constraint does not work...
Please someone helps me!
Thanks!