private void MoveObjects(Vector3Int offset) { List <GameObject> gameObjects = selectionGizmo.selectionFilter.GetSelectedGameObjects(); selectionGizmo.selectionFilter = SelectionFilter.FromGameObjects( gameObjects, selectionGizmo.selectionFilter.min + offset, selectionGizmo.selectionFilter.max + offset); foreach (GameObject gameObject in gameObjects) { gameObject.transform.position += offset; } }
private void RotateObject(Vector3Int rotation) { var pivot = moveGizmo.transform.position; var rotation90 = Vector3Int.RoundToInt((Vector3)rotation / 90f) * 90; var rotationDelta = rotation90 - lastRotation; if (rotationDelta != Vector3Int.zero) { SelectionFilter selectionFilter = selectionGizmo.selectionFilter; List <GameObject> gameObjects = selectionFilter.GetSelectedGameObjects(); selectionGizmo.selectionFilter = SelectionFilter.FromGameObjects(gameObjects, Vector3Int.RoundToInt(((Vector3)selectionFilter.min).Rotate(rotationDelta, pivot)), Vector3Int.RoundToInt(((Vector3)selectionFilter.max).Rotate(rotationDelta, pivot))); foreach (GameObject gameObject in gameObjects) { gameObject.transform.RotateAround(pivot, ((Vector3)rotationDelta).normalized, rotationDelta.magnitude); } } lastRotation = rotation90; }