Hi,
I have rigid body which is attached to the physics world using a btHingeConstraint. I have applied a motor torque using enableAngularMotor function. Can anybody tell me how to stop the rotation? The below code is not stopping the rotation.
float targetVelocity = 0.f;
float maxMotorImpulse = 0.0f;
hinge->enableAngularMotor(false, targetVelocity,maxMotorImpulse);
regards
Bindumol
btHingeConstraint::enableAngularMotor doubt
-
- Posts: 15
- Joined: Thu May 08, 2008 9:55 am
- Location: India, Kerala
-
- Posts: 169
- Joined: Sun Jan 14, 2007 7:56 pm
- Location: Norway
Re: btHingeConstraint::enableAngularMotor doubt
Seems you are setting the maximum motor impulse to zero. The motor won't be able to stop it's rotation when the max impulse it may use is zero, so increase maxMotorImpulse to something > 0.0. As for what value to choose, you'll have to experiment a bit, it depends on how strong your motor is supposed to be.
Best regards,
Ola
Best regards,
Ola
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: btHingeConstraint::enableAngularMotor doubt
We will double-check the hinge motor contribution.
In the meanwhile, can you try out the btSliderConstraint? In the latest Bullet version it has a linear and angular motor, and you can configure it to be a hinge.
Thanks for the feedback,
Erwin
In the meanwhile, can you try out the btSliderConstraint? In the latest Bullet version it has a linear and angular motor, and you can configure it to be a hinge.
Thanks for the feedback,
Erwin
-
- Posts: 15
- Joined: Thu May 08, 2008 9:55 am
- Location: India, Kerala
Re: btHingeConstraint::enableAngularMotor doubt
Hi,
Thanks for the reply...Now i can stop the rotation by giving high impulse to the hingemotor.
I tries it with the btSliderConstraint but i didn't get the rotation like a hinge constraint...can u help me ...
spSlider = new btSliderConstraint(*RigidBody1,*fixedbody,Transform,Transform1,false);
spSlider->setLowerLinLimit(-15.0F);
spSlider->setUpperLinLimit(-5.0F);
spSlider->setLowerAngLimit(0);
spSlider->setUpperAngLimit(100);
World->addConstraint(spSlider, true);
Thanks
Bindumol
Thanks for the reply...Now i can stop the rotation by giving high impulse to the hingemotor.
I tries it with the btSliderConstraint but i didn't get the rotation like a hinge constraint...can u help me ...
spSlider = new btSliderConstraint(*RigidBody1,*fixedbody,Transform,Transform1,false);
spSlider->setLowerLinLimit(-15.0F);
spSlider->setUpperLinLimit(-5.0F);
spSlider->setLowerAngLimit(0);
spSlider->setUpperAngLimit(100);
World->addConstraint(spSlider, true);
Thanks
Bindumol
-
- Posts: 56
- Joined: Sat Mar 08, 2008 12:37 am
Re: btHingeConstraint::enableAngularMotor doubt
Hello,
Do you use the 2.69 version of Bullet? Earlier vesions do not have motors in the btSliderConstraint
To enable rotatiolal motor use code like
spSlider = new btSliderConstraint(*RigidBody1,*fixedbody,Transform,Transform1,false);
spSlider->setLowerLinLimit(-15.0F);
spSlider->setUpperLinLimit(-5.0F);
spSlider->setLowerAngLimit(0);
spSlider->setUpperAngLimit(100);
spSlider->setPoweredAngMotor(true);
spSlider->setMaxAngMotorForce(10.0);
spSlider->setTargetAngMotorVelocity(1.0);
World->addConstraint(spSlider, true);
Hope this will help,
Roman
Do you use the 2.69 version of Bullet? Earlier vesions do not have motors in the btSliderConstraint
To enable rotatiolal motor use code like
spSlider = new btSliderConstraint(*RigidBody1,*fixedbody,Transform,Transform1,false);
spSlider->setLowerLinLimit(-15.0F);
spSlider->setUpperLinLimit(-5.0F);
spSlider->setLowerAngLimit(0);
spSlider->setUpperAngLimit(100);
spSlider->setPoweredAngMotor(true);
spSlider->setMaxAngMotorForce(10.0);
spSlider->setTargetAngMotorVelocity(1.0);
World->addConstraint(spSlider, true);
Hope this will help,
Roman
-
- Posts: 15
- Joined: Thu May 08, 2008 9:55 am
- Location: India, Kerala
Re: btHingeConstraint::enableAngularMotor doubt
hi,
Thanks for the reply...one more doubt...how i can make an angular rotation using hinge by giving the values as degrees...is it possible?
Thanks for the reply...one more doubt...how i can make an angular rotation using hinge by giving the values as degrees...is it possible?
-
- Posts: 25
- Joined: Thu Nov 29, 2007 7:08 pm
Re: btHingeConstraint::enableAngularMotor doubt
There's an example of how to set a target angle in MotorDemo.cpp. See enableAngularMotor(...) and the code just above it.
(Though I agree it would be nice to provide this as a service in the constraint class.)
Cheers,
Eddy
(Though I agree it would be nice to provide this as a service in the constraint class.)
Cheers,
Eddy
-
- Posts: 15
- Joined: Thu May 08, 2008 9:55 am
- Location: India, Kerala
Re: btHingeConstraint::enableAngularMotor doubt
Hi,
If i am using the hinge motor then also i am having the problem as to stop the motor within nthe limit & to avoid the swining of the motor within the limit.How it can possible? Is it possible by using the setDamping to the body.
If i am using the hinge motor then also i am having the problem as to stop the motor within nthe limit & to avoid the swining of the motor within the limit.How it can possible? Is it possible by using the setDamping to the body.