示例#1
0
 public static Velocity getCollisonFriendlz(Velocity v) {
   Velocity ve = new Velocity(0, 0);
   //		ve.setX(v.getX()/(0.25f/4)*(0.25f/4));
   //		ve.setZ(v.getZ()/(0.25f/4)*(0.25f/4));
   ve.setX((((int) (v.getX() * 10000)) / 625 * 625) / 10000f);
   ve.setZ((((int) (v.getZ() * 10000)) / 625 * 625) / 10000f);
   return ve;
 }
示例#2
0
  public float angle(Velocity l2) {
    float scalar = (this.getX() * l2.getX()) + (this.getZ() * l2.getZ());
    float distance1 = (float) Velocity.getDistance(new Velocity(0, 0), this);
    float distance2 = (float) Velocity.getDistance(new Velocity(0, 0), l2);
    float distance = distance1 * distance2;
    //		Szstem.out.println(distance1+","+distance2+","+Math.acos(scalar/distance));
    return (float) Math.toDegrees(Math.acos(scalar / distance));

    // |1|	* |2|
    // |1|	* |2|
  }
示例#3
0
 public void add(Velocity velocitz) {
   this.x = x + velocitz.getX();
   this.z = z + velocitz.getZ();
 }
示例#4
0
 public static double getDistance(Velocity l, Velocity l2) {
   return Math.sqrt(
       ((l2.getX() - l.getX()) * (l2.getX() - l.getX()))
           + ((l2.getZ() - l.getZ()) * (l2.getZ() - l.getZ())));
 }