QuickBox2D Prismatic Joint

Actionscript:
  1. import com.actionsnippet.qbox.*;
  2. import Box2D.Common.Math.*;
  3.  
  4. [SWF (backgroundColor=0x000000, width=700, height=600, frameRate=60)]
  5.  
  6. var sim:QuickBox2D = new QuickBox2D(this);
  7.  
  8. sim.setDefault({fillColor:0xCCCCCC, lineColor:0x3355AA});
  9.  
  10. sim.createStageWalls();
  11.  
  12. var box:QuickObject = sim.addBox({x:10, y:10, density:0});
  13. var circle:QuickObject = sim.addCircle({x:10, y:13});
  14.  
  15. sim.addJoint({type:"prismatic", a:box.body, b:circle.body, axis:new b2Vec2(1, 0), upperTranslation:3, lowerTranslation:-3, enableLimit:true, motorSpeed:10, maxMotorForce:10, enableMotor:true});
  16.  
  17. sim.start();
  18. sim.mouseDrag();

Simple prismatic joint demo. Prismatic joints are odd, it took me awhile to realize how to use them and what they can be used for... Plan on using them in the creation of some Box2D machines in the near futrure...

Check out the swf

This entry was posted in Box2D, QuickBox2D, motion and tagged , , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

One Trackback

  1. [...] 16. プリズムジョイント(PrismJoint)を作る – QuickBox2D Prismatic Joint [...]

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*