The online racing simulator
Incorrect side mapping orientation when car body is set to swap
On my Karobus 734, I'm trying to support driver side swap. I want to mirror the entire body of the bus, because the doors need to be on the correct side. But when I test it with the right side driving position, the side mapping is incorrect.




Here's my left/right swap mode:



To illustrate this issue better, I've made a simple box car with labelled side mappings. When I select right driver side, the mappings are oriented in such a way that front part of the mapping is actually located at the back of the car.




What I would like to achieve is to have the mappings flipped horizontally when drive side is swapped:



Is there a way to do this in the editor?
Attached images
lfs_00000424.jpg
lfs_00000426.jpg
lfs_00000427.jpg
lfs_00000436.jpg
lfs_00000437.jpg
lfs_00000431.jpg
lfs_00000432.jpg
lfs_00000438.jpg
Here's the box car test
Attached files
DRIVER SWAP.7z - 198.1 KB - 58 views
Did you try to use both "cutout" and "opposite" cutouts in your "body_right" and "body_left" mappings? Two different cutouts for one mapping might be a solution.
I don't think "opposite" will work for this case. I don't have mirrored triangles on the opposite side - the sides have different triangles.
It seems odd. I need to understand why this happens, if it is a bug in a specific situation (that can be safely fixed) or if it it really coded this way for other reasons, that would then break something if I "fixed" it.

I'll look in the model later and try to understand how or why the mapping or the cutout is flipped to what looks like an invalid state. But as time is tight I thought I'd mention it here in advance, in case you knew any more about the reasons why it behaves this way.
Quote from Flame CZE :I don't think "opposite" will work for this case. I don't have mirrored triangles on the opposite side - the sides have different triangles.

I was thinking about two cutouts for one side, not for the whole bus. Let us have 4 different side cutouts:
A - with doors, B - without doors, C - with doors flipped, D - without doors flipped. Then the right side mapping would be defined as cutout A with opposite D and the left side as cutout B with opposite C. Of course, in case that it is an editor bug, this is only a workaround.
In my mod "BUG WAGON" this also happens, I'm trying to fix it somehow, but I still haven't found out why this happens.
Quote from stuchlo :I was thinking about two cutouts for one side, not for the whole bus. Let us have 4 different side cutouts:
A - with doors, B - without doors, C - with doors flipped, D - without doors flipped. Then the right side mapping would be defined as cutout A with opposite D and the left side as cutout B with opposite C. Of course, in case that it is an editor bug, this is only a workaround.

I've tried this but it doesn't help.




Swapped mode:
At first sight it's not really a 'bug' as such, but more that skins were not designed for use with the swap side process.

A little logic is applied by LFS when flipping the mapping, which it does for each mapping that is used by any triangle that is set to swap sides.

That is:

IF texture is skin OR texture is mirror/clocks OR mapping name starts U_
> avoid flip
ELSE // standard texture
> do not avoid flip

For Flame's case: If you do it with the texture *not* as a skin, then I think you get the result you want. In that case you can make it act as if it was a skin by naming the mapping "U_..."

It seems we have a way to force mappings using standard textures to "avoid flip", by naming them "U_..." but the trouble is we don't have a way to do the opposite thing, force mappings using a skin to "not avoid flip".

I don't know what the best solution would be yet. A special name will not work, as you already named them like C1_ or M2_ etc. I suppose we would need a special switch in the mapping to force the required swapping behavior.

Or maybe I'm barking up the wrong tree and really the exclusion "texture is skin" should be excluded from the code above.

I've tried this and it seems to work with normal cars. Also it 'works' with Henricat's BUG WAGON. That now behaves as Flame would like the bus to behave. Image swaps side with the driver swap, and text is reversed. But there is no "shading error" where the darker patches are on the shaded texture. But with standard mapped cars I'm not seeing a problem.

The only question now is, how much stuff will be broken if I simply remove this code, that looks like it was added for a reason? Maybe that reason is simply no longer valid? One way could be - release a test patch quickly and see if the complaints come in!
I thought it was not a bug - my use case is just special Big grin

Quote from Scawen :I've tried this and it seems to work with normal cars. Also it 'works' with Henricat's BUG WAGON. That now behaves as Flame would like the bus to behave. Image swaps side with the driver swap, and text is reversed. But there is no "shading error" where the darker patches are on the shaded texture. But with standard mapped cars I'm not seeing a problem.

The only question now is, how much stuff will be broken if I simply remove this code, that looks like it was added for a reason? Maybe that reason is simply no longer valid? One way could be - release a test patch quickly and see if the complaints come in!

This will work as long as there are no texts on the skin which need to face the correct direction. I imagine there would have to be a way to define separate skin cutouts for each driver side. Then for my bus mod, there would be 2 side cuouts on the skin for each side.
Quote from Flame CZE :I imagine there would have to be a way to define separate skin cutouts for each driver side.

I think this is too much do do at this point, but it seems to me that your case and henricat's case would be better served (for now) with the removed code (even though text is mirrored, that's better than the shading going wrong).

For most vehicles this change will not affect anything, as triangles that swap sides are not normally mapped to skin textures. Swap sides is done on interiors, and the skin is not there.

But if someone used a skin to map some triangles inside (or outside) the car that do swap side, this proposed change would affect those vehicles. I wonder how many of these vehicles there are.
Quote from Flame CZE :

When you turn off "flipped" for "side_flip" cutout, does it change anything? If no, I am out of ideas, maybe some workaround with mirrored subobjects can be done.
Quote from Scawen :At first sight it's not really a 'bug' as such, but more that skins were not designed for use with the swap side process.

Sorry, I did not try to suggest that it is a bug. I have just tried to help with this edge case using a workaround and tried to warn that such workarounds can be dangerous if it is a bug.
I'm leaning towards a quick D55 release to see if any reports come up.

It would allow skin textures to flip over just like normal textures, if they are on a surface that is set to swap sides (not the usual case).

The current system only seems suited to rectangles. The hypothesis is that removing the skin exception should be better, but we can see if error reports come in to counter this idea.
You can always quickly revert it back to original code if it causes more unexpected problems, but now is a good time for testing.

FGED GREDG RDFGDR GSFDG