我面对奇怪的行为,两个身体之间没有摩擦和动态。我在跟随代码(kotlin中的代码)中声明了主体:
val WALL_FIXTURE_DEF = PhysicsFactory.createFixtureDef(0f, 0f, 50f)
val ground = Rectangle(this.mCameraWidth / 2, wallWidth / 2 , this.mCameraWidth, wallWidth, this.vertexBufferObjectManager)
PhysicsFactory.createBoxBody(this.mPhysicsWorld, ground, BodyDef.BodyType.StaticBody, WALL_FIXTURE_DEF)
...
this.mBall = UniformColorSprite(this.mCameraWidth / 2, this.mCameraHeight /2 , TILE_WIDTH, TILE_HEIGHT, mBallTextureRegion, this.vertexBufferObjectManager)
val body: Body
val objectFixtureDef = PhysicsFactory.createFixtureDef(100f, 0.3f, 10f, false, CATEGORYBIT_CIRCLE, MASKBITS_CIRCLE, 0)
body = PhysicsFactory.createCircleBody(this.mPhysicsWorld, this.mBall, BodyDef.BodyType.DynamicBody, objectFixtureDef)
this.mPhysicsWorld.registerPhysicsConnector(PhysicsConnector(this.mBall, body, true, true))
你有什么想法吗?
答案 0 :(得分:0)
如果第二个车身是圆形的,那么它会产生一些扭矩,这可能会让人觉得当它实际工作时会产生不起作用的虚构并产生扭矩。
当您设置setFixedRotation
时,您可以阻止圆形滚动,然后您可以观察小说。
尝试将circleBody更改为多边形,看看会发生什么。