开发者

Gravity problem (When registerUpdateHandler?)

开发者 https://www.devze.com 2023-03-21 21:10 出处:网络
i have problem with gravity. I make map of my game with add some elements like boxes, brick etc. using this开发者_如何学编程 code:

i have problem with gravity. I make map of my game with add some elements like boxes, brick etc. using this开发者_如何学编程 code:

private void addFace2(final Scene pScene, final float pX, final float pY, final int pWidth, final int pHeight, final String pType, final String Gbodytype) {
        final Sprite face;
        final Body body2;
        BodyType bodytype;

        face = new Sprite(pX, pY, pWidth, pHeight, this.mBoxTextureRegion);

        bodytype = BodyType.DynamicBody;

        body2 = PhysicsFactory.createBoxBody(this.mPhysicsWorld, face, bodytype, boxFixtureDef);

        pScene.attachChild(face);
        this.mPhysicsWorld.registerPhysicsConnector(new PhysicsConnector(face, body2, true, true));
        boxy.add(face);

}

Everything is "ok" but the elements are bouncing!? I think the problem lies is in the this.mScene.registerUpdateHandler(this.mPhysicsWorld);.

I want to ask you how to stop bouncing not by removing the gravity?

http://s3.ifotos.pl/img/fail_hsrpxhe.png

Sorry for my english, I work on it..


Check your boxFixtureDef and the FixtureDef for whatever your using for the ground.

new FixtureDef(Density,Elasticity,Friction)

/** The friction coefficient, usually in the range [0,1]. **/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号