Box2D Forums

It is currently Thu May 23, 2013 3:42 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Revolute joint with as3
PostPosted: Wed May 18, 2011 2:54 pm 
Offline

Joined: Sat Mar 05, 2011 1:36 pm
Posts: 15
Hello everyone!
how do you create a revolute joint by as3 on to two different objects which are already in world? e.g. BoxMan fires contactEvent when in contact with a circle (shapes.Circle) then as3 snaps a revolute joint on BoxMan which attaches and overlaps BoxMan on to the other circle.


Attachments:
diagram.png
diagram.png [ 5.74 KiB | Viewed 1124 times ]


Last edited by hari.th on Sun May 22, 2011 2:35 am, edited 2 times in total.
Top
 Profile  
 
PostPosted: Fri May 20, 2011 12:43 am 
Offline

Joined: Sat Mar 05, 2011 1:36 pm
Posts: 15
Or is this an impossible topic to answer? I have seen mayobutters comment about creating a distance joint however when I'm trying to do the same it gives me errors and create two joints where they are suppose to be but with no connector.
Code:
var objectA:Ball = e.relatedObject as Ball;
   var objectB:BoxMan = e.target as BoxMan;
      if (objectA) {
         var j:Joint = new Joint();
         var j2:Joint = new Joint();
         j.type = 'Distance';
         j.x = objectB.body.x;
         j.y = objectB.body.y;
         j2.x = objectA.body.x;
         j2.y = objectA.body.y;
         j.targetObject1 = objectB.body;
         j.targetObject2 = j2;
         j2.targetObject1 = objectA.body;
         j.connectorClassName = 'ConnectorDots';
         this.addChild(j2);
         this.addChild(j);   

I am new to this and I have learnt so much in these three months but i would really like to finish my school project soon, so please help me!
Thank you in advance ;)


Top
 Profile  
 
PostPosted: Sat May 21, 2011 3:06 pm 
Offline

Joined: Sat Mar 05, 2011 1:36 pm
Posts: 15
Is there nobody who can help me :(


Top
 Profile  
 
PostPosted: Mon May 07, 2012 8:42 pm 
Offline

Joined: Mon May 07, 2012 8:39 pm
Posts: 3
Hi. I know this came in late, but if it doesn't help you, it might help someone else.

It looks like you're trying to set RevoluteJoint members directly. This is not desirable for init, and it caused me problems as well. Use the "Initialize" member of the RevolutionJointDef class, which includes the 2 bodies and the point of contact.


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

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


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