List of usage examples for com.badlogic.gdx.math.collision BoundingBox BoundingBox
public BoundingBox(BoundingBox bounds)
From source file:br.com.raphaelbruno.game.zombieinvaders.vr.model.GameObject.java
License:Apache License
public void updateBox() { Vector3 position = transform.getTranslation(new Vector3()); if (customBounds != null) bounds = new BoundingBox(customBounds); else/*from w w w . j ava 2 s. c om*/ calculateBoundingBox(bounds); bounds.getCenter(center); bounds.set(bounds.min.add(position.x, position.y, position.z), bounds.max.add(position.x, position.y, position.z)); }
From source file:com.mygdx.game.utilities.CameraController.java
License:Apache License
public void setWorldBoundingBox(BoundingBox worldBoundingBox) { this.worldBoundingBox = new BoundingBox(worldBoundingBox); Vector3 min = new Vector3(); Vector3 max = new Vector3(); // Set height of bounding box to zero (y dimension) this.worldBoundingBox.getMax(max).y = 0; this.worldBoundingBox.getMin(min).y = 0; this.worldBoundingBox.set(min, max); ray.set(camera.targetPosition, camera.targetDirection); if (!Intersector.intersectRayBounds(ray, this.worldBoundingBox, worldGroundTarget)) { // TODO: What happens if the center of camera is not aimed at bounding box? // Probably move the camera until it is... }//from w w w .ja va2s.co m }