kingBook

导航

焊接关节(Weld Joint)

package{
	import Box2D.Common.Math.b2Vec2;
	import Box2D.Dynamics.b2Body;
	import Box2D.Dynamics.Joints.b2WeldJointDef;
	
	public class Main extends BaseMain{
		
		
		public function Main(){
			super(new b2Vec2(0,10));
		}
		
		override protected function init():void{
			var bodyA:b2Body=this.createBox(50,50,400,300);
			var bodyB:b2Body=this.createCircle(25,500,300);
			
			var jointDef:b2WeldJointDef=new b2WeldJointDef();
			var anchor:b2Vec2=bodyA.GetWorldCenter();
			jointDef.Initialize(bodyA,bodyB,anchor);
			
			_world.CreateJoint(jointDef);
			
		}
		
	};
}


源码地址

posted on 2018-08-03 14:08  kingBook  阅读(1015)  评论(0编辑  收藏  举报