Example usage for com.badlogic.gdx.graphics.g3d ModelInstance calculateBoundingBox

List of usage examples for com.badlogic.gdx.graphics.g3d ModelInstance calculateBoundingBox

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics.g3d ModelInstance calculateBoundingBox.

Prototype

public BoundingBox calculateBoundingBox(final BoundingBox out) 

Source Link

Document

Calculate the bounding box of this model instance.

Usage

From source file:com.badlogic.gdx.tests.dragome.examples.bullet.BulletEntity.java

License:Apache License

public BulletEntity(final ModelInstance modelInstance, final btCollisionObject body) {
    this.modelInstance = modelInstance;
    this.transform = this.modelInstance.transform;
    this.body = body;

    modelInstance.calculateBoundingBox(boundingBox);
    boundingBoxRadius = boundingBox.getDimensions(new Vector3()).len() * 0.5f;

    if (body != null) {
        body.userData = this;
        if (body instanceof btRigidBody) {
            this.motionState = new MotionState(this.modelInstance.transform);
            ((btRigidBody) this.body).setMotionState(motionState);
        } else//from w  ww  .j av  a2 s .c  om
            body.setWorldTransform(transform);
    }
}

From source file:org.ah.gcode.preview.utils.SceneCameraInputController.java

License:Open Source License

public SceneCameraInputController(Camera camera, ModelInstance backgroundPlane) {
    this.camera = camera;
    this.backgroundPlane = backgroundPlane;
    this.backgroundPlaneBoundingBox = new BoundingBox();
    backgroundPlane.calculateBoundingBox(backgroundPlaneBoundingBox);
    rotateAroundVector = new Vector3();
}

From source file:scratchpad.LoadModelsTest.java

License:Apache License

private void doneLoading() {
    Model ship = assets.get(FN, Model.class);
    ModelInstance shipInstance = new ModelInstance(ship);
    BoundingBox b = new BoundingBox();
    shipInstance.calculateBoundingBox(b);
    Gdx.app.debug("kbn", String.format("instance bounding box: %s", b.toString()));
    instances.add(shipInstance);//from   w ww . ja va 2  s  .  c o  m
    loading = false;
}