0
即時通訊嘗試在box2d中使用棱鏡關節創建移動平臺,所有創建的都是一個盒子,並且沒有明顯的關節,我做錯了什麼?這裏是我的代碼Box2d As3棱鏡接頭不起作用?
var prismaticJoint:b2PrismaticJoint;
...
{
...
BodyDef.position.Set(0/RATIO, 0/RATIO);
floorDef.SetAsBox(250/RATIO, 10/RATIO);
fixtureDef.shape = floorDef;
fixtureDef.friction = 0.5;
fixtureDef.density = 0.5;
fixtureDef.restitution = 0;
movePlatformBody = PhysiVals.world.CreateBody(BodyDef);
movePlatformBody.CreateFixture(fixtureDef);
var prismaticJointDef:b2PrismaticJointDef = new b2PrismaticJointDef();
prismaticJointDef.Initialize(body, movePlatformBody, movePlatformBody.GetWorldCenter(), new b2Vec2(0,1));
prismaticJointDef.enableLimit = true;
prismaticJointDef.enableMotor = true;
prismaticJointDef.lowerTranslation = 0;
prismaticJointDef.maxMotorForce = 100;
prismaticJointDef.motorSpeed = 1;
prismaticJointDef.upperTranslation = 270/PhysiVals.RATIO;
PhysiVals.world.CreateJoint(prismaticJointDef);
//prismaticJoint = PhysiVals.world.CreateJoint(prismaticJointDef as b2JointDef) as b2PrismaticJoint;
我試過2種方式在世界上創建它,我不知道使用哪一個。如何在box2d中創建移動平臺?感謝您抽出時間來閱讀。
感謝您的回覆!我其實在看過你的教程,並且正在使用它和其他人。我試過,但它沒有工作,平臺只保持靜態,不移動,即使在調試繪製有任何線條指示聯合或任何東西,非常感謝您的幫助 – Farjuan 2013-03-20 02:33:58
嘗試更換不是意味着移動(作爲錨點)與身體PhysiVals.world.GetGroundBody()? – Allan 2013-03-20 03:25:54
是的,試過了,似乎還沒有工作,我試圖讓一些工作像[本] [http://www.actionscript.org/resources/articles/1087/12/Getting-Started-with -Box2D/Page12.html)教程,但我還沒有接近,再一次,結果只是一個靜態框,我試圖改變密度和其他值,但它只是保持靜態 – Farjuan 2013-03-20 04:24:15