Open hemebond opened 4 years ago
I wonder if the rotation direction is wrong. Tiled rotates clockwise by default, whereas Quake/Trenchbroom positive rotation is counter-clockwise.
90° clockwise (270° in Quake) is hflip+dflip. 180° is hflip+vflip. 270° clockwise (90° in Quake) is vflip+dflip.
The issue seems to be on prefabs where hflip is True (90° and 180°cw)
I think adding this to the end of the plane generation gives the correct result (so far):
# for the Z axis
if dominant_axis == Z_AXIS:
bearing = mathhelper.vector_from_angle(float(q.rotation))
bearing = tuple(numpy.dot(flip_matrix, (*bearing, 1))[:3])
q.rotation = mathhelper.angle_between(bearing)
# for the X and Y axis
if tile.flipped_horizontally:
if dominant_axis == X_AXIS or dominant_axis == Y_AXIS:
q.rotation = 360 - q.rotation
texture_offset = (texture_offset[0] * -1, texture_offset[1])
When a prefab is rotated the texture is sometimes incorrect.
E.g., prefab has been rotated 90° counter-clockwise, with door facing west: Before:
After rotation door faces south and textures not aligned: After:
Textures on the dominant Z axis (floor/ceiling) seem to be corrected with:
Environment: