Box2D Forums

It is currently Wed May 22, 2013 11:13 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Help with gears
PostPosted: Tue Feb 07, 2012 2:13 am 
Offline

Joined: Tue Feb 07, 2012 1:28 am
Posts: 6
Hi everyone,
i would like to get some help creating a gear with a revolute and prismatic joint. I would like to create something similar to the attached image from the Box2D Manual:
Attachment:
gear_manualBox2D.jpg
gear_manualBox2D.jpg [ 7.02 KiB | Viewed 832 times ]

I understand that it should be prismatic + revolute but can't figure out how to accomplish it with wck. I am a newbie so...
Any help would be really appreciated so thanks in advance!


Top
 Profile  
 
 Post subject: Re: Help with gears
PostPosted: Tue Feb 07, 2012 11:20 am 
Offline

Joined: Fri Dec 14, 2007 8:07 pm
Posts: 913
Were you able to setup the individual revolute & prismatic joints? If not just look at how they're setup in the demos. Then give both your joints instance names and then for one of them set the "pulleyGearPartnerName" property to the name of the other joint.


Top
 Profile  
 
 Post subject: Re: Help with gears
PostPosted: Wed Feb 08, 2012 4:59 am 
Offline

Joined: Tue Feb 07, 2012 1:28 am
Posts: 6
Hi, thanks a lot for your quick answer!
I am not sure it is that simple though… On another attempt I had two gears (revolute) working properly. In this case, I am trying to get to work the picture attached yesterday. The revolute joint (#1 over the circle) turns but the prismatic joint (#2 over the rectangle) turns around #1. It doesn't constraint its movement to a vertical axis (as shown in the figure). I haven't found an example like this one in the demo.
I also get this error:

Assertion failed: (def->bodyA != def->bodyB), function b2Joint, file ../Box2D/Dynamics/Joints/b2Joint.cpp, line 173.

[object AlchemyExit]
at <anonymous>()
at <anonymous>()
at Box2DAS.Dynamics.Joints::b2Joint()
at Box2DAS.Dynamics.Joints::b2GearJoint()
at wck::Joint/createGearJoint()
at wck::Joint/createJoint()
at wck::Joint/create()
at misc::Entity/ensureCreated()
at <anonymous>()

Thanks again for any ideas.


Top
 Profile  
 
 Post subject: Re: Help with gears
PostPosted: Fri Feb 10, 2012 1:20 pm 
Offline

Joined: Fri Dec 14, 2007 8:07 pm
Posts: 913
Ok lets forget the gear for now and just try to get the prismatic working. If you just drop a prismatic over an object it wont work because it doesn't have any direction. Try putting the joint somewhere outside of the object (or over another object) then setting the "target2Name" to the instance name of your rectangle.

The "joints" demo should have a working prismatic somewhere in there...


Top
 Profile  
 
 Post subject: Re: Help with gears
PostPosted: Sat Feb 11, 2012 2:16 am 
Offline

Joined: Tue Feb 07, 2012 1:28 am
Posts: 6
Wow!
YES, you put me on the right track. Thanks very much. I got it working.
Great tool and great help!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group