Example usage for com.badlogic.gdx.math.collision BoundingBox getCenter

List of usage examples for com.badlogic.gdx.math.collision BoundingBox getCenter

Introduction

In this page you can find the example usage for com.badlogic.gdx.math.collision BoundingBox getCenter.

Prototype

@Deprecated
public Vector3 getCenter() 

Source Link

Usage

From source file:com.badlogic.gdx.graphics.g3d.test.Viewer.java

License:Apache License

@Override
public void create() {

    Texture texture = new Texture(Gdx.files.internal("data/models/ninja.jpg"));
    Material mat = new Material("mat", new TextureAttribute(texture, 0, "s_tex"),
            new ColorAttribute(Color.CYAN, ColorAttribute.diffuse));
    model = new OgreXmlLoader().load(Gdx.files.internal("data/models/ninja.mesh.xml"),
            Gdx.files.internal("data/models/ninja.skeleton.xml"));
    model.setMaterial(mat);//from w ww  .  ja  va 2 s . c o  m

    cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    BoundingBox bounds = model.subMeshes[0].mesh.calculateBoundingBox();
    cam.position.set(bounds.getCenter().cpy().add(100, 100, 100));
    cam.lookAt(bounds.getCenter().x, bounds.getCenter().y, bounds.getCenter().z);
    cam.near = 0.1f;
    cam.far = 1000;

    renderer = new ImmediateModeRenderer10();
    batch = new SpriteBatch();
    font = new BitmapFont();

    for (String name : model.skeleton.animations.keys())
        animNames.add(name);
    animation = animNames.get(0);

}