저는 box2d 및 libgdx 게임 개발 프레임 워크를 처음 사용합니다.왜 몸이 중력 아래 떨어지고 있지 않습니까?
나는 세계와 원 모양을 만들었습니다.
나는 Trouble with Gravity에있다. libgdx box2d에서 만든 Circle은 중력에 빠지지 않습니다. plz 내가이 문제에 붙어 도와주세요.
public void render(float delta) {
Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
box2dDebugRenderer.render(world, orthographicCamera.projection);
world.step(TIME_STEMP, VELOCITY_ITERAIONS, POSITION_ITERATION);
System.out.println(b.getPosition().y);
}
@Override
public void resize(int width, int height) {
orthographicCamera.setToOrtho(false, width/10, height/10);
orthographicCamera.update();
}
@Override
public void show() {
world = new World(new Vector2(0, -9.81f), true);
box2dDebugRenderer = new Box2DDebugRenderer();
orthographicCamera = new OrthographicCamera();
BodyDef balldef = new BodyDef();
balldef.type = BodyType.DynamicBody;
balldef.position.set(0, 1);
CircleShape ballshape = new CircleShape();
ballshape.setRadius(1f);
FixtureDef ballfixture = new FixtureDef();
ballfixture.density = 1000f;
ballfixture.friction = .3f;
ballfixture.restitution = .7f;
ballfixture.shape = ballshape;
b = world.createBody(balldef);
f = b.createFixture(ballfixture);
}
그러면 어떻게 될까요? 시체가 조용히있어? – ssantos
예 y 방향으로 위치를 변경하지 마십시오 –
단계 상수 값을 게시 할 수 있습니까? – ssantos