Apply motor to only one body of a joint?

Discuss issues specific to the Flash/AS3 port of Box2D
jacobholm
Posts: 3
Joined: Mon May 19, 2014 8:43 am

Apply motor to only one body of a joint?

Postby jacobholm » Mon May 19, 2014 8:53 am

Idea: I want a wheel with a stick attached to it by a joint. Then I want to move the wheel back and forth in order to balance the stick, keeping it from falling to the ground.

At first I tried a revolute joint between the wheel and the stick. Then I used SetLinearVelocity to the wheel body which worked ok. Then I thought I might try a motor on the joint, but it seems to affect both bodies, removing the challenge of balancing the stick. Is there some way to apply the motor to only the wheel? Perhaps I need another type of joint?

Thanks!

irresistible force
Posts: 1991
Joined: Tue Jun 24, 2008 8:25 pm
Location: Tokyo
Contact:

Re: Apply motor to only one body of a joint?

Postby irresistible force » Tue May 20, 2014 9:45 am

No, that is not possible without some customization of the engine internals. How about putting a fixed rotation body between the two bodies, so that they are not directly connected.
You might find this interesting, since it does exactly what you are talking about and has source code: https://www.youtube.com/watch?v=LH0pRDIeZB8

jacobholm
Posts: 3
Joined: Mon May 19, 2014 8:43 am

Re: Apply motor to only one body of a joint?

Postby jacobholm » Thu May 22, 2014 10:37 am

Thank you very much! I will take a look =)


Return to “Flash”



Who is online

Users browsing this forum: No registered users and 1 guest