Package soc.qase.tools.vecmath

Examples of soc.qase.tools.vecmath.Vector3f


1' option.
@param clipPos the position to which the agent should clip */
/*-------------------------------------------------------------------*/
  protected void clipToPosition(Vector3f clipPos)
  {
    initPos = (clipPos == null ? null : new Vector3f(clipPos));
    initPosReached = (initPos == null);
  }
View Full Code Here


        sendConsoleCommand("noclip");
        isNoClip = true;
      }
      else
      {
        Vector3f pos = new Vector3f(world.getPlayer().getPlayerMove().getOrigin());
        pos.sub(initPos, pos);

        if(pos.length() < 2)
        {
          pacify();
          initPosReached = true;
          sendConsoleCommand("noclip");
        }
        else
          setBotMovement(pos, null, (pos.length() > 50 ? 400 : 10), PlayerMove.POSTURE_NORMAL);
      }
    }
    else if(isNoClip)
    {
      Vector v = world.getMessages();
View Full Code Here

  public BSPLeaf(byte[] leafData, int offset)
  {
    brushOr = Utils.unsignedIntValue(leafData, offset);
    cluster = Utils.unsignedShortValue(leafData, offset + 4);
    area = Utils.unsignedShortValue(leafData, offset + 6);
    bboxMin = new Vector3f(Utils.shortValue(leafData, offset + 8), Utils.shortValue(leafData, offset + 10), Utils.shortValue(leafData, offset + 12));
    bboxMax = new Vector3f(Utils.shortValue(leafData, offset + 14), Utils.shortValue(leafData, offset + 16), Utils.shortValue(leafData, offset + 18));
    firstLeafFace = Utils.unsignedShortValue(leafData, offset + 20);
    numLeafFaces = Utils.unsignedShortValue(leafData, offset + 22);
    firstLeafBrush = Utils.unsignedShortValue(leafData, offset + 24);
    numLeafBrushes = Utils.unsignedShortValue(leafData, offset + 26);   
  }
View Full Code Here

  public float getObstacleDistance(Vector3f start, Vector3f dir, float maxDist)
  {
    if(!mapRead)
      return Float.NaN;

    Vector3f end = getObstacleLocation(start, dir, maxDist);

    end.sub(start);
    return end.length();
  }
View Full Code Here

  public float getObstacleDistance(Vector3f start, Vector3f dir, float sphereRadius, float maxDist)
  {
    if(!mapRead)
      return Float.NaN;

    Vector3f end = getObstacleLocation(start, dir, sphereRadius, maxDist);

    end.sub(start);
    return end.length();
  }
View Full Code Here

  public float getObstacleDistance(Vector3f start, Vector3f dir, Vector3f boundingBoxMins, Vector3f boundingBoxMaxs, float maxDist)
  {
    if(!mapRead)
      return Float.NaN;

    Vector3f end = getObstacleLocation(start, dir, boundingBoxMins, boundingBoxMaxs, maxDist);

    end.sub(start);
    return end.length();
  }
View Full Code Here

/*-------------------------------------------------------------------*/
/*-------------------------------------------------------------------*/
  private Vector3f getEndpoint(Vector3f start, Vector3f dir, float maxDist)
  {
    Vector3f end = new Vector3f(dir);

    end.normalize();
    end.scale(maxDist);
    end.add(start);

    return end;
  }
View Full Code Here

    if(mins.length() == 0 && maxs.length() == 0)
      return traceLine(start, end);

    TRACE_TYPE = TRACE_BOX;

    traceMins = new Vector3f(mins);
    traceMaxs = new Vector3f(maxs);

    for(int i = 0; i < 3; i++)
      traceExtents.set(i, Math.max(-traceMins.get(i), traceMaxs.get(i)))

    return trace(start, end);
View Full Code Here

      {
        outputEnd.set(i, inputStart.get(i) + outputFraction * (inputEnd.get(i) - inputStart.get(i)));
      }
    }

    return new Vector3f(outputEnd);
  }
View Full Code Here

    }
    else
    // the line spans the splitting plane
      int side;
      float fraction1, fraction2, middleFraction;
      Vector3f middle = new Vector3f(0, 0, 0);

      // split the segment into two
      if (startDistance < endDistance)
      {
        side = 1; // back
        float inverseDistance = 1.0f / (startDistance - endDistance);
        fraction1 = (startDistance - offset + EPSILON) * inverseDistance;
        fraction2 = (startDistance + offset + EPSILON) * inverseDistance;
      }
      else if (endDistance < startDistance)
      {
        side = 0; // front
        float inverseDistance = 1.0f / (startDistance - endDistance);
        fraction1 = (startDistance + offset + EPSILON) * inverseDistance;
        fraction2 = (startDistance - offset - EPSILON) * inverseDistance;
      }
      else
      {
        side = 0; // front
        fraction1 = 1.0f;
        fraction2 = 0.0f;
      }
 
      // make sure the numbers are valid
      if (fraction1 < 0.0f) fraction1 = 0.0f;
      else if (fraction1 > 1.0f) fraction1 = 1.0f;
      if (fraction2 < 0.0f) fraction2 = 0.0f;
      else if (fraction2 > 1.0f) fraction2 = 1.0f;
 
      // calculate the middle point for the first side
      middleFraction = startFraction + (endFraction - startFraction) * fraction1;

      for (int i = 0; i < 3; i++)
        middle.set(i, start.get(i) + fraction1 * (end.get(i) - start.get(i)));

      // check the first side
      checkNode(node.children[side], startFraction, middleFraction, start, middle );
 
      // calculate the middle point for the second side
      middleFraction = startFraction + (endFraction - startFraction) * fraction2;

      for (int i = 0; i < 3; i++)
        middle.set(i, start.get(i) + fraction2 * (end.get(i) - start.get(i)));

      // check the second side
      checkNode(node.children[(side + 1) % 2], middleFraction, endFraction, middle, end );
    }
  }
View Full Code Here

TOP

Related Classes of soc.qase.tools.vecmath.Vector3f

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.