Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I am facing a new problem by using chain shape. The collision between two chain shape bodies doesn't happen as the collision between normal bodies. So is this normal behaviour or am i doing anything wrong?

Following are the code for this purpose.

            ChainShape mChainShape = new ChainShape();
            Vector2[] mVector2 = new Vector2[lineList.size()];

            for (int i = 0; i < lineList.size(); i++) {
                    mVector2[i] = new Vector2(lineList.get(i).getX1()
                                    / PhysicsConstants.PIXEL_TO_METER_RATIO_DEFAULT,
                                    lineList.get(i).getY1()
                                    / PhysicsConstants.PIXEL_TO_METER_RATIO_DEFAULT);
            }

            mChainShape.createChain(mVector2);
            FixtureDef mFixtureDef = new FixtureDef();
            Body mChainBody;
            BodyDef mBodyDef = new BodyDef();
            mBodyDef.type = BodyType.DynamicBody;
            mChainBody = mPhysicsWorld.createBody(mBodyDef);
            mFixtureDef.shape = mChainShape;
            mFixtureDef.density = 1f;
            mFixtureDef.friction = 0.5f;
            mFixtureDef.restitution = 0.5f;
            mChainBody.createFixture(mFixtureDef);
            mChainShape.dispose();

if I want to create body based on touch coordinates then this thing possible or not?

Please give any guidance in this.

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.