Physics Simulation Forum

 

All times are UTC




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: 2.74 btHingeConstraint "angular only" not used
PostPosted: Fri Mar 20, 2009 4:38 am 
Offline

Joined: Fri Mar 20, 2009 3:26 am
Posts: 6
btHingeConstraint does not use the m_angularOnly flag (enabled by setAngularOnly(...)) in its new solver implementation, which is the default. It will only take effect if you use the obsolete solver implementation, which can be enabled with the following client code:

Code:
#define IN_PARALLELL_SOLVER // !!! grants public access to btHingeConstraint data members
#include <BulletDynamics/ConstraintSolver/btHingeConstraint.h>
. . .
btHingeConstraint * hinge = new btHingeConstraint( . . . )
hinge->setAngularOnly( true );
hinge->m_useSolveConstraintObsolete = true; // !!! normally a private data member
. . .


I am using a btHingeConstraint to achieve an "upright" constraint that has been discussed elsewhere in the forum. I had to make this fix after upgrading from 2.73 to 2.74 in order to get double-precision (BT_USE_DOUBLE_PRECISION) working successfully on Gentoo GNU/Linux for amd64.

I have recently replaced our own physics engine with Bullet, and am very pleased with the results. The code is well designed and easy to follow. The overall object design and C++ coding style is actually very close to ours, which made the integration surprisingly easy. The lead game designer got even more excited when she saw everything in our world bouncing around!

Great work guys :D
--Christopher


Top
 Profile  
 
 Post subject: Re: 2.74 btHingeConstraint "angular only" not used
PostPosted: Mon Jul 19, 2010 10:06 pm 
Offline

Joined: Fri Mar 20, 2009 3:26 am
Posts: 6
FYI, this solution no longer works in Bullet 2.76; the constraint just doesn't take effect--I don't know why yet.

If anyone has solved the "upright" problem effectively, please post your solution. Nothing that I have yet tried with hinge or 6dof constraints, or the custom UprightConstraint code (which no longer compiles successfully) has yet to work. :(

Thanks
-- Christopher


Top
 Profile  
 
 Post subject: Re: 2.74 btHingeConstraint "angular only" not used
PostPosted: Tue Jul 20, 2010 1:13 pm 
Offline
Site Admin
User avatar

Joined: Sun Jun 26, 2005 6:43 pm
Posts: 3179
Location: California, USA
arcwf wrote:
FYI, this solution no longer works in Bullet 2.76; the constraint just doesn't take effect--I don't know why yet.

If anyone has solved the "upright" problem effectively, please post your solution. Nothing that I have yet tried with hinge or 6dof constraints, or the custom UprightConstraint code (which no longer compiles successfully) has yet to work. :(

Thanks
-- Christopher

We removed the obsolete code of the btHingeConstraint, not realizing that the 'angular factor' was not implemented in the new code. We'll look into fixing this.

In the meanwhile: have you tried using the angular factor, that can force objects to stay up (only allow rotation along a given world-space axis), for example if gravity is the Y axis:
Code:
btVector3 angFac(0,1,0);
body->setAngluarFactor(angFac);


Thanks,
Erwin


Top
 Profile  
 
 Post subject: Re: 2.74 btHingeConstraint "angular only" not used
PostPosted: Wed Jul 21, 2010 10:53 pm 
Offline
Site Admin
User avatar

Joined: Sun Jun 26, 2005 6:43 pm
Posts: 3179
Location: California, USA
Latest trunk should add support for angularOnly hinges: see http://bit.ly/cH8Kqy

Can you try if this works for you?
Thanks,
Erwin


Top
 Profile  
 
 Post subject: Re: 2.74 btHingeConstraint "angular only" not used
PostPosted: Tue Jul 27, 2010 4:21 pm 
Offline

Joined: Fri Mar 20, 2009 3:26 am
Posts: 6
Thanks Erwin.

I have just built the latest Bullet SVN trunk. Unfortunately, using the non-obsolete solver in this version with hinge->setAngularOnly(true) also constrains translation rather than just affecting "angular only", i.e. the body will rotate as desired but not move. However, our code that sets up the hinge is the same as it was for Bullet 2.74, so it is possible that we need to code the setup differently to get it working properly.

On the other hand, while your were making the change for btHingeConstraint::setAngularOnly(...), I did solve the "upright" problem using the btGeneric6DofConstraint instead, and it works perfectly! That solution is described in post viewtopic.php?f=9&t=4457&p=19494#p19494

Your suggestion to use btRigidBody::setAngularFactor(...) also works and is clearly the simplest solution of all. Nevertheless, the btGeneric6DofConstraint solution is the best for us because our worlds are spherical planets, so the "upright" axis changes as bodies move rather than being fixed to the universal Y axis.

Thanks :D
Christopher


Top
 Profile  
 
 Post subject: Re: 2.74 btHingeConstraint "angular only" not used
PostPosted: Thu Jul 29, 2010 8:04 pm 
Offline
Site Admin
User avatar

Joined: Sun Jun 26, 2005 6:43 pm
Posts: 3179
Location: California, USA
Quote:
Unfortunately, using the non-obsolete solver in this version with hinge->setAngularOnly(true) also constrains translation rather than just affecting "angular only", i.e. the body will rotate as desired but not move.


That was not intended, we'll test and fix this asap.

Good you found another solution, thanks for the feedback!
Erwin


Top
 Profile  
 
 Post subject: Re: 2.74 btHingeConstraint "angular only" not used
PostPosted: Fri Jul 30, 2010 10:59 pm 
Offline
Site Admin
User avatar

Joined: Sun Jun 26, 2005 6:43 pm
Posts: 3179
Location: California, USA
"angular only" is now fixed and tested in latest trunk: http://code.google.com/p/bullet/source/detail?r=2154

The hinge also has a local axis, so it should work for spherical worlds/gravity. Anyhow, if the btGeneric6DofConstraint works for you, you might just stick with that.
Thanks for the feedback,
Erwin


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group