Package com.badlogic.gdx.math

Examples of com.badlogic.gdx.math.Vector3


    lookAt(0, 0, 0);
    normalizeUp();
  }

  private float calculateAngle (float a) {
    Vector3 camPos = calculateDirection(a);
    position.set(camPos.mul(30));
    lookAt(0, 0, 0);
    normalizeUp();
    update();

    Vector3 orig = new Vector3(0, 0, 0);
    Vector3 vec = new Vector3(1, 0, 0);
    project(orig);
    project(vec);
    Vector2 d = new Vector2(vec.x - orig.x, -(vec.y - orig.y));
    return d.angle();
  }
View Full Code Here


    return d.angle();
  }

  private Vector3 calculateDirection (float angle) {
    Matrix4 transform = new Matrix4();
    Vector3 dir = new Vector3(-1, 0, 1).nor();
    float rotAngle = (float)Math.toDegrees(Math.asin(Math.tan(Math.toRadians(angle))));
    transform.setToRotation(new Vector3(1, 0, 1).nor(), angle);
    dir.mul(transform).nor();
    return dir;
  }
View Full Code Here

    ));
    // @on

    dodistortion = barrelDistortion;

    vtint = new Vector3();
    tint = new Color();
    chromaticDispersion = new Vector2();

    setTime(0f);
    setTint(1.0f, 1.0f, 0.85f);
View Full Code Here

    // adds the points given to the spline as control points
    // the mandatory length is 4 and the first and last are not used as
    // control points
    for (Vector2 point : path) {
      spline.add(new Vector3(point.x, point.y, 0));

    }

    // creates a new vector3 array that has enough space for all points in
    // the spline.
    this.path = new Vector3[(path.size - 2) * pointsPerSegment];

    for (int i = 0; i < this.path.length; i++) {
      this.path[i] = new Vector3();
    }
    // creates and inserts new points between the control points into the
    // given Vector3 array at the rate of pointsPerSegment
    spline.getPath(this.path, pointsPerSegment);
  }
View Full Code Here

    time += (Gdx.graphics.getDeltaTime() * Configuration.frameRate);
    while (time >= 1) {
      time--;
      point++;
      Vector3 point1 = this.path[point];
      if (previousPosition != null) {
        if (previousPosition.x - point1.x < -.002f) {
          entity.setMOVE_LEFT(false);
          entity.setMOVE_RIGHT(true);
         
View Full Code Here

  };
 
  private final static Array<Vector3> vectorArray = new Array<Vector3>();
 
  private Vector3 tmp(float x, float y, float z) {
    final Vector3 result = vectorPool.obtain().set(x, y, z);
    vectorArray.add(result);
    return result;
  }
View Full Code Here

        vertTmp3.set(corner100, null, null, null), vertTmp4.set(corner110, null, null, null),
        vertTmp5.set(corner001, null, null, null), vertTmp6.set(corner011, null, null, null),
        vertTmp7.set(corner101, null, null, null), vertTmp8.set(corner111, null, null, null));
    } else {
      ensureRectangles(6);
      Vector3 nor = tempV1.set(corner000).lerp(corner110, 0.5f).sub(tempV2.set(corner001).lerp(corner111, 0.5f)).nor();
      rect(corner000, corner010, corner110, corner100, nor);
      rect(corner011, corner001, corner101, corner111, nor.scl(-1));
      nor = tempV1.set(corner000).lerp(corner101, 0.5f).sub(tempV2.set(corner010).lerp(corner111, 0.5f)).nor();
      rect(corner001, corner000, corner100, corner101, nor);
      rect(corner010, corner011, corner111, corner110, nor.scl(-1));
      nor = tempV1.set(corner000).lerp(corner011, 0.5f).sub(tempV2.set(corner100).lerp(corner111, 0.5f)).nor();
      rect(corner001, corner011, corner010, corner000, nor);
      rect(corner100, corner110, corner111, corner101, nor.scl(-1));
    }
  }
View Full Code Here

      ensureRectangles((divisions + 1)*2, divisions + 1);
    }
   
    final float ao = MathUtils.degreesToRadians * angleFrom;
    final float step = (MathUtils.degreesToRadians * (angleTo - angleFrom)) / divisions;
    final Vector3 sxEx = tempV1.set(tangentX, tangentY, tangentZ).scl(width * 0.5f);
    final Vector3 syEx = tempV2.set(binormalX, binormalY, binormalZ).scl(height * 0.5f);
    final Vector3 sxIn = tempV3.set(tangentX, tangentY, tangentZ).scl(innerWidth * 0.5f);
    final Vector3 syIn = tempV4.set(binormalX, binormalY, binormalZ).scl(innerHeight * 0.5f);
    VertexInfo currIn = vertTmp3.set(null, null, null, null);
    currIn.hasUV = currIn.hasPosition = currIn.hasNormal = true;
    currIn.uv.set(.5f, .5f);
    currIn.position.set(centerX, centerY, centerZ);
    currIn.normal.set(normalX, normalY, normalZ)
View Full Code Here

    if (offset < 0 || dimensions < 1 || (offset + dimensions) > vertexSize)
      throw new IndexOutOfBoundsException();
    if (start < 0 || count < 1 || ((start + count) * vertexSize) > vertices.length)
      throw new IndexOutOfBoundsException("start = "+start+", count = "+count+", vertexSize = "+vertexSize+", length = "+vertices.length);
   
    final Vector3 tmp = new Vector3();
   
    int idx = offset + (start * vertexSize);
    switch(dimensions) {
    case 1:
      for (int i = 0; i < count; i++) {
        tmp.set(vertices[idx], 0, 0).mul(matrix);
        vertices[idx] = tmp.x;
        idx += vertexSize;
      }
      break;
    case 2:
      for (int i = 0; i < count; i++) {
        tmp.set(vertices[idx], vertices[idx + 1], 0).mul(matrix);
        vertices[idx] = tmp.x;
        vertices[idx+1] = tmp.y;
        idx += vertexSize;
      }
      break;
    case 3:
      for (int i = 0; i < count; i++) {
        tmp.set(vertices[idx], vertices[idx + 1], vertices[idx + 2]).mul(matrix);
        vertices[idx] = tmp.x;
        vertices[idx+1] = tmp.y;
        vertices[idx+2] = tmp.z;
        idx += vertexSize;
      }
View Full Code Here

   
    // Comprueba el estado de los enemigos
    for (Enemy enemy : levelManager.enemies) {
     
      // Si la cámara no los enfoca no se actualizan
      if (!camera.frustum.pointInFrustum(new Vector3(enemy.position.x, enemy.position.y, 0)))
        continue;
   
      if (enemy.isAlive)
        enemy.update(dt);
      else
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.