Quick question: how to get constraints for a rigid body?

kate
Posts: 41
Joined: Thu Jan 08, 2009 11:20 am
Location: London, UK

Quick question: how to get constraints for a rigid body?

Post by kate »

Hi,

Can anyone tell me if there's a simple way of getting the constraints that affect a given rigid body (without looping through all the constraints in the world and checking their rigid body pointers)?

getConstraintRef() etc. only work if collisions between the constrained rigid bodies are disabled, which isn't always the case for our simulations...

Thanks,

Kate
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Quick question: how to get constraints for a rigid body?

Post by Erwin Coumans »

You will have to iterate through all constraints in the world, and compare pointers, the functionality is not currently available.

You can manually add/remove the constraints in a separate array in a derived class from btRigidBody if needed. If you think it is useful to others, please submit a patch and we consider applying it.
Thanks!
Erwin
kate
Posts: 41
Joined: Thu Jan 08, 2009 11:20 am
Location: London, UK

Re: Quick question: how to get constraints for a rigid body?

Post by kate »

Hi Erwin,

Thanks for the reply... I just wanted to make sure I hadn't missed something :)

For now I'm just keeping a list of the constraints per rigid body outside of Bullet; I guess most people will do something similar in any case, or just know how they've set things up, though I did think of making a derived or "wrapper" class as you suggest; if I do do that I'll let you know.

Regards,

Kate