setWorldTransform() failed when apply on constraint (hinge)

papaonn
Posts: 41
Joined: Wed Nov 20, 2013 4:14 pm

setWorldTransform() failed when apply on constraint (hinge)

Post by papaonn »

I found that when i add hinge constraint to attach 2 rigid bodies together,
and if i apply setWorldTransform() try to repositioning / rotating the object, the constraint is working weird,
because it looks like the object constraint is having a very loose / error attachment.

I tried to fix the rotation of the bodies so that they looked like they are nailed together fixing the rotation.
but if i apply setWorldTransform() trying to rotate one of the body A,
bodyB rotation just goes freely which is not what i would like to see.

May i know is there anything i could try working to resolve this problem?

I have tried applyImpulse() etc and that seems working fine but that's not natural to applyImpulse to just rotate the entire body.

Please advise, thanks! 8)
jrandom
Posts: 5
Joined: Wed Jan 01, 2014 11:22 pm

Re: setWorldTransform() failed when apply on constraint (hin

Post by jrandom »

This is a situation I'm going to be facing soon (I finally got the Hello World program to run, so I can finally start to actually glue things together now) and one of the questions that arose was: "If I translate/rotate a core body into another coordinate reference frame, do I also have to manually update the positions of all bodies attached to it by constraints?"

At this point I'm guessing "yes", but I don't actually know for sure yet.
bwelch
Posts: 48
Joined: Thu Dec 12, 2013 4:04 pm

Re: setWorldTransform() failed when apply on constraint (hin

Post by bwelch »

I've only just begun working with Bullet, so I'm no expert, but it sounds like you could use some additional constraints to hold one of your bodies in place. Check out the Constraint Demo. It has a ton of examples of how you can fasten things in place. You may want to change your hinge constraint into a 6DoF constraint so you have more control over it.

Although I've run into problems where my constraints aren't very "sturdy" even when I lock their angular or linear motion. I guess that's just a problem I have to deal with. Good luck.