예제 #1
0
 public void changeHeight(float value) {
   for (int i = 0; i < getSelectionCircles().size(); i++) {
     Doodad d = getSelectionCircles().get(i).getDoodad();
     d.setHeight(d.getHeight() + value);
     d.updateSpatial();
     getSelectionCircles().get(i).update();
   }
 }
예제 #2
0
  public void rotateToPoint(Vector3f v3f) {
    for (int i = 0; i < getSelectionCircles().size(); i++) {
      Doodad d = getSelectionCircles().get(i).getDoodad();

      Vector3f location = d.getLocation();
      float rotation =
          (float)
              Math.atan2(
                  (float) (v3f.getX() - location.getX()), (float) (v3f.getZ() - location.getZ()));
      d.setRotation(rotation);
      d.updateRotation();
    }
  }
예제 #3
0
  public void addDoodad(Doodad d) {
    getSelectionCircles().add(new SelectionCircle(editorApp, d, new ColorRGBA(0, 1, 0, 1), true));

    if (d.getPathingSize() > 0) {
      moveSmooth = false;
    }
  }
예제 #4
0
  public void drag(Vector3f location) {
    float changeX = location.x - dragPoint.x;
    float changeY = location.z - dragPoint.y;

    if (moveSmooth) {
      for (int i = 0; i < getSelectionCircles().size(); i++) {
        Doodad d = getSelectionCircles().get(i).getDoodad();

        Vector2f v2f = new Vector2f();
        v2f.x = d.getLocation().x + changeX;
        v2f.y = d.getLocation().z + changeY;

        d.setLocation(v2f, editorApp.getTerrainManager());
        d.updateLocation();

        getSelectionCircles().get(i).update();
      }
    } else {
      for (int i = 0; i < getSelectionCircles().size(); i++) {
        Doodad d = getSelectionCircles().get(i).getDoodad();

        Vector2f v2fold = new Vector2f(d.getLocation().getX(), d.getLocation().getZ());

        Vector2f v2f = dragPositions.get(i);
        v2f.x += changeX;
        v2f.y += changeY;

        d.removeSpace(editorApp.getPathingManager().getPathingMap(), PathingMap.LayerUnit);
        d.setLocation(v2f, editorApp.getTerrainManager());

        if (d.hasSpace(editorApp.getPathingManager().getPathingMap()) == false) {
          d.setLocation(v2fold, editorApp.getTerrainManager());
        }
        d.setSpace(editorApp.getPathingManager().getPathingMap(), PathingMap.LayerUnit);
        d.updateLocation();
        getSelectionCircles().get(i).update();
      }
    }

    dragPoint.setX(location.x);
    dragPoint.setY(location.z);
  }