1
A
回答
1
答案是:棱柱關節。我將圖像分爲兩部分:靜態和動態(移動條)。下面的代碼是用於在我的問題中創建像圖像一樣的棱鏡聯合:
//prismatic joint
final Sprite springFrameT = new Sprite(pX, pY, mSpringFrameTRegion, getVertexBufferObjectManager());
final Sprite springBarT = new Sprite(pX, pY + mSpringFrameTRegion.getHeight()-mSpringBarTRegion.getHeight(),
mSpringBarTRegion, getVertexBufferObjectManager());
mMainScene.attachChild(springFrameT);
mMainScene.attachChild(springBarT);
mMapSprites.add(springFrameT);
mMapSprites.add(springBarT);
final Body springFrameBody = PhysicsFactory.createBoxBody(mPhysicsWorld, springFrameT, BodyType.StaticBody, FIXTURE_DEF);
final Body springBarBody = PhysicsFactory.createBoxBody(mPhysicsWorld, springBarT, BodyType.DynamicBody, SPRING_FIXTURE_DEF);
mPhysicsWorld.registerPhysicsConnector(new PhysicsConnector(springFrameT, springFrameBody, false, false));
mPhysicsWorld.registerPhysicsConnector(new PhysicsConnector(springBarT, springBarBody, true, true));
final PrismaticJointDef prismaticJointDef = new PrismaticJointDef();
prismaticJointDef.initialize(springFrameBody, springBarBody, springFrameBody.getWorldCenter(), // new Vector2(springFrameT.getWidth(), springFrameT.getHeight()/2),
new Vector2(0, 1.0f));
prismaticJointDef.lowerTranslation = -0.5f;
prismaticJointDef.upperTranslation = 0.5f;
prismaticJointDef.enableLimit = true;
prismaticJointDef.enableMotor = true;
prismaticJointDef.maxMotorForce = 100.0f;
prismaticJointDef.motorSpeed = 100000f;
prismaticJointDef.collideConnected = false;
this.mPhysicsWorld.createJoint(prismaticJointDef);
相關問題
- 1. Box2d - AndEngine
- 2. 人丁與AndEngine和Box2D的
- 3. AndEngine,box2d和Galaxy Tab問題
- 4. 擺動在AndEngine和box2d
- 5. AndEngine和box2d碰撞過濾
- 6. andEngine Box2D DrawingShapes
- 7. AndEngine with Box2D Extension
- 8. Andengine Box2D的爆炸
- 9. Body Adjustable Velocity AndEngine/Box2D
- 10. box2d和libgdx中的彈弓
- 11. box2d彈簧網格紋理圖
- 12. box2d中的易破牆
- 13. AndEngine Box2D的身體GetContactList
- 14. 如何使用Box2d在andEngine中製作彈道軌跡?
- 15. 物理與Box2d和Andengine教程
- 16. AndEngine Box2D中的獨特實體
- 17. 無法用Box2D跳入Andengine
- 18. AndEngine Box2D擴展 - 縮放
- 19. AndEngine物理Box2D擴展
- 20. 在Andengine Box2d身體運動
- 21. IndexOutOfBoundsException彈簧批量和彈簧啓動
- 22. Angular2與彈簧靴和彈簧安全
- 23. 彈簧啓動和彈簧安全4.0
- 24. 如何在AndEngine中製作彈簧效果
- 25. 從牆上跳到牆上? - box2d
- 26. Andengine/Box2D平臺遊戲中的物理和重力
- 27. 設置摩擦動態在AndEngine Box2D的
- 28. 牛頓在andengine上的搖籃,box2d
- 29. 身體的極限線速度andengine box2d
- 30. 彈球遊戲中的Box2d彈弓