2D Joint Motor For Angle Joint

Please don't post Bullet support questions here, use the above forums instead.
Post Reply
crashlander
Posts: 41
Joined: Sat Apr 08, 2006 11:20 am

2D Joint Motor For Angle Joint

Post by crashlander »

In my 2D physics engine I have a 'FixedAngleJoint'. This joint constrains two bodies to remain at some fixed angle. This joint is implemented using a Baumgarte factor and the ideas in Box2D.

I want to dynamically modify the target angle in order to allow the user to control objects in my app. So far, I've just been changing the target angle directly based on mouse-position or keyboard input.

I have a feeling there is a smarter way to do this using motors. I'm looking for some info on how to implement motors for situation as described above.

I'm aware of the previous discussion (http://www.continuousphysics.com/Bullet ... .php?t=517) on how Baumgarte joints don't necassarily hold up well to strong motors but I'm hoping it will be good enough for my purposes.

-Jeff
Erin Catto
Posts: 316
Joined: Fri Jul 01, 2005 5:29 am
Location: Irvine
Contact:

Post by Erin Catto »

It sounds like what you have is about right. The only difference with a motor would be clamping the impulse torque according to some maximum. Also you might want to use a different Baumgarte parameter than you use for other constraints.

Be aware that the movement speed will depend on the time step. To prevent this, use a motor Baumgarte parameter that is proprotional to the time step (this will cancel out a division by the time step in the velocity bias).

A more sophisticated approach is to use a prescribe angular velocity until the joint gets close to the target angle, at which point you would switch over to Baumgarte. If done correctly, this can lead to fast and smooth movement.
crashlander
Posts: 41
Joined: Sat Apr 08, 2006 11:20 am

Post by crashlander »

Thanks Erin. Exactly what I was looking for.

My timesteps are constant so I don't think I need to tie by Baumgarte factor to the timestep.
Post Reply