This tool flips coordinates in Gothic 2 .zen world files to help with map mirroring modifications.
- Flips
trafoOSToWSPos(position vectors) across selected axes - Flips
positionanddirection(waypoint data) - Flips
bbox3DWS(bounding boxes) to maintain correct bounds - Flips
trafoOSToWSRot(rotation matrices) when using-rotationflag - Supports X, Y, Z axis flipping individually or in combination
- Preserves original file formatting and encoding (UTF-8, Windows-1252, ASCII)
- Dry run mode to test file encoding without transformations
Requires .NET 6.0 or later.
dotnet build -c ReleaseThe executables will be in bin/Release/net6.0/
This tool has been verified against manual transformations. Here's a real example:
Original object:
bbox3DWS: 15557.8027 1032.73633 -27.5603027 16030.5684 1442.10681 465.1138
trafoOSToWSRot: 86972e3f00000000173a3b3f000000000000803f00000000173a3bbf0000000086972e3f
trafoOSToWSPos: 15794.1846 1215.23633 218.777618
After X-axis flip with -x -rotation:
bbox3DWS: -16030.5684 1032.73633 -27.5603027 -15557.8027 1442.10681 465.1138
trafoOSToWSRot: [negated first column of rotation matrix]
trafoOSToWSPos: -15794.1846 1215.23633 218.777618
The tool matches the manual transformation process exactly.
ZenFlipper <input.zen> <output.zen> [options]-x- Flip X axis only (default if no option specified)-y- Flip Y axis only-z- Flip Z axis only-xy- Flip X and Y axes-xz- Flip X and Z axes-yz- Flip Y and Z axes-xyz- Flip all three axes
Flip along X axis (for mirroring left-right):
ZenFlipper NEWWORLD.ZEN NEWWORLD_FLIPPED.ZEN -xFlip along Z axis:
ZenFlipper NEWWORLD.ZEN NEWWORLD_FLIPPED.ZEN -zFlip along both X and Z axes:
ZenFlipper NEWWORLD.ZEN NEWWORLD_FLIPPED.ZEN -xzThe tool handles three types of coordinate data in .zen files:
Used for regular game objects (items, sounds, NPCs, etc.)
Original:
trafoOSToWSPos=vec3:-1135.65906 -420.442902 5063.6123
After X-axis flip:
trafoOSToWSPos=vec3:1135.65906 -420.442902 5063.6123
Used for navigation waypoints (where NPCs walk, spawn points, etc.)
Original:
position=vec3:-153.670609 -125.461304 -1740.34607
After X-axis flip:
position=vec3:153.670609 -125.461304 -1740.34607
Direction vectors that NPCs face at waypoints
Original:
direction=vec3:-0.615661502 0 0.788010716
After X-axis flip:
direction=vec3:0.615661502 0 0.788010716
Original:
bbox3DWS=rawFloat:-1735.65906 -1020.44287 4463.6123 -535.659058 179.557098 5663.6123
After X-axis flip (min/max values are swapped and negated):
bbox3DWS=rawFloat:535.659058 -1020.44287 4463.6123 1735.65906 179.557098 5663.6123
In Gothic 2's coordinate system:
- X axis: Left-Right (typically flipped for mirroring)
- Y axis: Up-Down (vertical)
- Z axis: Forward-Backward (depth)
Since you mentioned flipping the 3D world via X axis, use the -x option.
If Gothic 2 crashes when loading your flipped .zen file, try these steps:
Before trying any transformations, test if file encoding/format is the issue:
# Build the dry run tool
cd ZenDryRun
dotnet build -c Release
# Test: Read and write the ORIGINAL file without changes
ZenDryRun ORIGINAL.ZEN TEST_OUTPUT.ZENThis will:
- Detect the file encoding (UTF-8, Windows-1252, ASCII, etc.)
- Analyze line endings (CRLF vs LF)
- Write the file back unchanged
- Compare byte-for-byte to verify no corruption
Then test in Gothic 2:
- If
TEST_OUTPUT.ZENloads fine → File format is OK, transformation is the issue - If
TEST_OUTPUT.ZENcrashes → Original file may be corrupted OR encoding issue
If files are byte-identical but game still crashes: Your transformation logic needs adjustment (continue to Step 1 below)
If files differ: Encoding conversion occurred. The tool will suggest encoding options to try.
First, analyze your flipped .zen file to identify issues:
ZenDiagnostic NEWWORLD_FLIPPED.ZENThis will show you:
- Invalid bounding boxes (where min > max)
- Coordinate ranges and distributions
- Suggested axis to flip
Error: "UNHANDLED EXCEPTION" or crash on load
This usually means:
- Wrong axis flipped - Try
-zinstead of-x, or vice versa - Rotation matrices need flipping - Add
-rotationflag - Bounding boxes are invalid - The diagnostic tool will detect this
Objects appear but in wrong locations
- Your mesh flip and coordinate flip are using different axes
- Make sure both use the same axis (e.g., both X or both Z)
World loads but looks corrupted
- Try adding the
-rotationflag to flip rotation matrices too
Test different combinations in this order:
# Test 1: X-axis only
ZenFlipper original.zen test1.zen -x
# Test 2: Z-axis only
ZenFlipper original.zen test2.zen -z
# Test 3: X-axis with rotation
ZenFlipper original.zen test3.zen -x -rotation
# Test 4: Z-axis with rotation
ZenFlipper original.zen test4.zen -z -rotationLoad each test file in Gothic 2 to see which works.
Before applying changes, preview what will happen:
ZenFlipper input.zen -preview -xThis shows the first 5 transformations without modifying the file.
Preview changes before applying:
ZenFlipper NEWWORLD.ZEN -preview -xApply X-axis flip:
ZenFlipper NEWWORLD.ZEN NEWWORLD_FLIPPED.ZEN -xApply with rotation matrices:
ZenFlipper NEWWORLD.ZEN NEWWORLD_FLIPPED.ZEN -x -rotationVerbose output to see changes:
ZenFlipper NEWWORLD.ZEN NEWWORLD_FLIPPED.ZEN -x -verboseAlways test with a small portion of your world first:
- Make a backup of your original .zen file
- Run the tool with your desired axis
- Load the world in Gothic 2 to verify correct placement
- If objects appear in wrong positions, try a different axis combination
Objects appear on the wrong side:
- Try
-xif you used-z, or vice versa
Objects are upside down:
- Try adding or removing
-yfrom your axis combination
Objects are in completely wrong positions:
- Verify you flipped the 3D meshes using the same axis
- Check that both the mesh flip and coordinate flip use matching axes