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); }
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(); } }