1 package{ 2 import Box2D.Common.Math.b2Vec2; 3 import Box2D.Dynamics.b2Body; 4 import Box2D.Dynamics.Joints.b2PrismaticJointDef; 5 6 /** 7 * 8 */ 9 public class Main extends BaseMain{ 10 11 12 public function Main(){ 13 super(new b2Vec2(0,10)); 14 } 15 16 override protected function init():void{ 17 var bodyA:b2Body=this.createBox(50,50,100,400); 18 var bodyB:b2Body=this.createCircle(25,700,400); 19 20 21 var jointDef:b2PrismaticJointDef=new b2PrismaticJointDef(); 22 23 var anchor:b2Vec2=bodyA.GetWorldCenter(); 24 var axis:b2Vec2=new b2Vec2(1,0); 25 jointDef.Initialize(bodyA,bodyB,anchor,axis); 26 _world.CreateJoint(jointDef); 27 28 bodyA.SetFixedRotation(true); 29 } 30 31 32 }; 33 }
源码下载:http://yunpan.cn/c3aTsiqhQ6Ikc 访问密码 41ea
时间: 2024-10-25 05:05:52