Best way to implement a motor on one body?

Post Reply
sak
Posts: 3
Joined: Tue Oct 18, 2016 2:49 pm

Best way to implement a motor on one body?

Post by sak » Thu Nov 16, 2017 4:47 pm

I want to implement a capsule representation for a character which behaves kind of like one of those inflatable punching bags (http://shop-boxen.de/wp-content/uploads ... -Bag-0.jpg)

Basically the character should stand up straight, but rather than locking the angular factor on the rigid body representation, it should be able to be knocked off kilter and then right itself.

I'm thinking it might make sense to accomplish this with a motor: basically I could compare the desired orientation with the current orientation and then applying an angular motor target speed to correct the difference.

The question is:

1. Does this approach make sense?

2. What's the best way to implement the motor? I see that the 6DOF constraint has motor control members: can I implement a 6DOF constraint which is only attached to one rigid body?

User avatar
xissburg
Posts: 38
Joined: Sat May 19, 2007 9:28 pm
Location: Santo André-SP, Brazil

Re: Best way to implement a motor on one body?

Post by xissburg » Fri Nov 17, 2017 3:35 am

1. Does this approach make sense?

I guess. You should get similar behavior using a capsule shape with a very low center of mass (use a compound shape to displace the center of mass).

2. What's the best way to implement the motor? I see that the 6DOF constraint has motor control members: can I implement a 6DOF constraint which is only attached to one rigid body?

You can create constraints with only one body (it gets attached to a static object under the hood). You could use a btGeneric6DofSpringConstraint to make it wobble around by adjusting the spring stiffness and damping.

User avatar
drleviathan
Posts: 371
Joined: Tue Sep 30, 2014 6:03 pm
Location: San Francisco

Re: Best way to implement a motor on one body?

Post by drleviathan » Fri Nov 17, 2017 3:49 pm

The low center of mass approach will Just Work. I've seen it used for exactly that purpose: a punching bag that stands up by itself.

Post Reply