Examples of subtractLocal()


Examples of com.jme3.math.Vector2f.subtractLocal()

  }

  private static Vector2f getPointPercentagePosition(Geometry terrain,
      Vector3f worldLoc, float scaledWidth) {
    Vector2f uv = new Vector2f(worldLoc.x, worldLoc.z);
    uv.subtractLocal(terrain.getWorldTranslation().x,
        terrain.getWorldTranslation().z); // center it on 0,0
    // float scaledSize = terrain.getTerrainSize()*scale;
    uv.addLocal(scaledWidth / 2, scaledWidth / 2); // shift the bottom left
                            // corner up to 0,0
    uv.divideLocal(scaledWidth); // get the location as a percentage
View Full Code Here

Examples of com.jme3.math.Vector3f.subtractLocal()

    private void calcTurn(boolean useWalkAnimation) {
        Vector3f worldTranslation = spatial.getWorldTranslation();
        Vector3f targetVec = new Vector3f(target);
        targetVec.setY(spatial.getLocalTranslation().getY());
        targetVec.subtractLocal(worldTranslation);
        turnFrom = spatial.getLocalRotation().clone();
        turnTo.lookAt(targetVec, Vector3f.UNIT_Y);
        float angle1 = FastMath.RAD_TO_DEG * turnTo.toAngles(null)[1];
        float angle2 = FastMath.RAD_TO_DEG * turnFrom.toAngles(null)[1];
        if (angle1 < 0f) {
View Full Code Here

Examples of com.jme3.math.Vector3f.subtractLocal()

      if(renderDebug && bboxes.getChildren().size()<=0){
        Vector3f origin = cam.getWorldCoordinates(
            inputManager.getCursorPosition(), 0.0f);
        Vector3f direction = cam.getWorldCoordinates(
            inputManager.getCursorPosition(), 0.3f);
        direction.subtractLocal(origin).normalizeLocal();
       
        Line li = new Line(origin.clone(), origin.add(direction.mult(30f)));
//        li.setLineWidth(3f);
        Geometry g = new Geometry(null, li);
      g.setMaterial(matWireframe);
View Full Code Here

Examples of com.jme3.math.Vector3f.subtractLocal()

      Singleton sin = Singleton.get();
      Vector3f origin = camera.getWorldCoordinates(
          inputManager.getCursorPosition(), 0.0f);
      Vector3f direction = camera.getWorldCoordinates(
          inputManager.getCursorPosition(), 0.3f);
      direction.subtractLocal(origin).normalizeLocal();

      Ray ray = new Ray(origin, direction);
      CollisionResults results = new CollisionResults();

      sin.getSceneManager().getRoot().collideWith(ray, results);
View Full Code Here

Examples of com.jme3.math.Vector3f.subtractLocal()

            if (isGrassLayer(candidateGrassPatchLocation, terrain,
                minIntensity, terrainWidth, channelId)) {
              // this will be in world coords, but we want it to
              // be in local
              candidateGrassPatchLocation.subtractLocal(terrain
                  .getWorldTranslation());
              grassLayer.attachChild(createGrassPatch(
                  candidateGrassPatchLocation, faceMat,
                  patchScaleVariation, patchWidth,
                  patchHeight, rand.nextFloat()));
View Full Code Here

Examples of com.jme3.math.Vector3f.subtractLocal()

        if (enabled && spatial != null) {
            Quaternion localRotationQuat = spatial.getLocalRotation();
            Vector3f localLocation = spatial.getLocalTranslation();
            if (!applyLocal && spatial.getParent() != null) {
                getPhysicsLocation(localLocation);
                localLocation.subtractLocal(spatial.getParent().getWorldTranslation());
                localLocation.divideLocal(spatial.getParent().getWorldScale());
                tmp_inverseWorldRotation.set(spatial.getParent().getWorldRotation()).inverseLocal().multLocal(localLocation);
                spatial.setLocalTranslation(localLocation);

                if (useViewDirection) {
View Full Code Here

Examples of com.jme3.math.Vector3f.subtractLocal()

                for (int i = 0; i < l.size(); i += 3) {
                    Vector3f pos = new Vector3f();
                    pos.x = l.get(i);
                    pos.y = l.get(i + 1);
                    pos.z = l.get(i + 2);
                    pos.subtractLocal(initialPosition).multLocal(initialScale);
                    points.add(pos.x);
                    points.add(pos.y);
                    points.add(pos.z);
                }
            }
View Full Code Here

Examples of com.jme3.math.Vector3f.subtractLocal()

                Vector3f pos = new Vector3f();
                pos.x = vertices.get(i);
                pos.y = vertices.get(i + 1);
                pos.z = vertices.get(i + 2);
                pos.subtractLocal(offset).multLocal(initialScale);
                results.add(pos.x);
                results.add(pos.y);
                results.add(pos.z);

            }
View Full Code Here

Examples of com.jme3.math.Vector3f.subtractLocal()

        return center;
    }

    public Vector3f getNormal(){
        Vector3f normal = new Vector3f(pointb);
        normal.subtractLocal(pointa).crossLocal(pointc.x-pointa.x, pointc.y-pointa.y, pointc.z-pointa.z);
        normal.normalizeLocal();
        return normal;
    }

    public float getExtreme(int axis, boolean left){
View Full Code Here

Examples of com.jme3.math.Vector3f.subtractLocal()

            // preparing UV coordinates for the flatted texture
            this.uv = new Vector2f[3];
            this.uv[0] = new Vector2f(FastMath.clamp(v1.subtract(envelope.min).length(), 0, Float.MAX_VALUE) / envelope.height, 0);
            Vector3f heightDropPoint = v2.subtract(envelope.w);// w is directed from the base to v2
            this.uv[1] = new Vector2f(1, heightDropPoint.subtractLocal(envelope.min).length() / envelope.height);
            this.uv[2] = new Vector2f(0, 1);
        }

        /**
         * This method computes the final UV coordinates for the image (after it
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.