Package com.badlogic.gdx.math

Examples of com.badlogic.gdx.math.Vector3


  }

  public void changeZoom(float zoom, float x, float y) {

  Vector3 before = new Vector3(x, y, 0);
  camera.unproject(before);

  camera.zoom = zoom;
  camera.update();
  Vector3 after = new Vector3(x, y, 0);
  camera.unproject(after);

  camera.translate(before.x - after.x, before.y - after.y, 0);
  }
View Full Code Here


   
    // Set animation on track 0.
    state.setAnimation(0, "run", true);

    Gdx.input.setInputProcessor(new InputAdapter() {
      final Vector3 point = new Vector3();

      public boolean touchDown (int screenX, int screenY, int pointer, int button) {
        camera.unproject(point.set(screenX, screenY, 0)); // Convert window to world coordinates.
        bounds.update(skeleton, true); // Update SkeletonBounds with current skeleton bounding box positions.
        if (bounds.aabbContainsPoint(point.x, point.y)) { // Check if inside AABB first. This check is fast.
          BoundingBoxAttachment hit = bounds.containsPoint(point.x, point.y); // Check if inside a bounding box.
          if (hit != null) {
            System.out.println("hit: " + hit);
View Full Code Here

    Gdx.gl.glActiveTexture(GL20.GL_TEXTURE0);
  }

  public void resize(int width, int height) {
    super.resize(width, height);
    Vector3 oldPosition = new Vector3();
    Vector3 oldDirection = new Vector3();
    if (cam != null) {
      oldPosition.set(cam.position);
      oldDirection.set(cam.direction);
      cam = new PerspectiveCamera(28, Gdx.graphics.getWidth(),
          Gdx.graphics.getHeight());
      cam.position.set(oldPosition);
      cam.direction.set(oldDirection);
    } else {
View Full Code Here

      ship.update(delta);
    }
   
    for (int e = 0; e < bullets.size; e++) {
      if (bullets.get(e).body.getLinearVelocity().len2()<5) {
        deadBullets.add(new DeadCannonBall(new Vector3(bullets.get(e).body.getWorldCenter().x,bullets.get(e).body.getWorldCenter().y,0), bullets.get(e).body.getAngle()));
       
        world.destroyBody(bullets.get(e).body);
        bullets.removeIndex(e);       
      }
    }   
   
    while(deadBullets.size>100) {
      deadBullets.removeIndex(0);       
    }
   
    while(deadEnemies.size>20) {
      deadEnemies.removeIndex(0);       
    }   
   
    for (int e = 0; e < network.enemies.size; e++) {
      if (network.enemies.get(e).life <= 0 && network.enemies.get(e).body.getLinearVelocity().len2()<5) {
        deadEnemies.add(new DeadEnemyShip(new Vector3(network.enemies.get(e).body.getWorldCenter().x,network.enemies.get(e).body.getWorldCenter().y,0), network.enemies.get(e).body.getAngle()));
       
        world.destroyBody(network.enemies.get(e).body);
        network.enemies.removeIndex(e);
       
      }
View Full Code Here

   
   
    diffuseShader.end();
   
    //update cam
    Vector3 position3 = new Vector3();
    model.getTranslation(position3);
    cam.position.set(position3.x, (-position3.z/4.0f)+10, position3.y-20);
    cam.lookAt(0, (position3.y/1.5f)-2, position3.y);
   
   
View Full Code Here

TOP

Related Classes of com.badlogic.gdx.math.Vector3

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.