Hi everyone,
I have been playing with bullet constraints for several weeks now and I had a question about btHinge and btConeTwist constraints: Is there a way to set a rest angle/state which the constraint tries to return to during the simulation?
Thanks in advance.
btHingeConstraint rest angle
-
- Posts: 463
- Joined: Fri Nov 30, 2012 4:50 am
Re: btHingeConstraint rest angle
Just add a motor and use a feedback controller to set it back to some angle. You can even do fancy things like returning after a specified time, saloon style high oscillation doors, or even auto-locking. I would suggest you look at the dynamic control demo and how PID controllers work.TGFX wrote:Hi everyone,
I have been playing with bullet constraints for several weeks now and I had a question about btHinge and btConeTwist constraints: Is there a way to set a rest angle/state which the constraint tries to return to during the simulation?
Thanks in advance.
-
- Posts: 5
- Joined: Fri May 14, 2010 1:28 pm
Re: btHingeConstraint rest angle
Thanks for the answer Basroil,
Actually, I'm trying to implement a rod-like hinge chain and I would like to be able to tune its stiffness. I'm having interesting results using motors but not satisfying enough...
Has anyone done this before ?
Actually, I'm trying to implement a rod-like hinge chain and I would like to be able to tune its stiffness. I'm having interesting results using motors but not satisfying enough...
Has anyone done this before ?
-
- Posts: 463
- Joined: Fri Nov 30, 2012 4:50 am
Re: btHingeConstraint rest angle
You'll definitely have to use the new features of 2.82 for good results, or at least high iterations and small step size. Featherstone body should work well (haven't tried yet) and the direct solvers do work very well (3x speed improvement for about the same quality as 500 joint iterations even at half the frequency). My longest chain is only 18 joints in pitch-yaw though (using small step size and 500 iterations, direct solver tests are all with three joints with parallel axis), but if you're making a 1000 element rod, I have a feeling that you might want to look elsewhere to solve it before considering physics.
-
- Posts: 5
- Joined: Fri May 14, 2010 1:28 pm
Re: btHingeConstraint rest angle
Actually, I have implemented my own class publicly inheriting form btHingeConstraint and redefined getInfo2 to had an angular spring damper and the result is pretty cool.
I was about to do the same thing for the btConeTwist contraint but it looks like it doens't handle maxMotorImpulse correctly...
I was about to do the same thing for the btConeTwist contraint but it looks like it doens't handle maxMotorImpulse correctly...