Page 1 of 1

[boskid][1.1.61] Selection box doesn't handle 8 way rotations correctly when set in a custom entity prototype

Posted: Fri Jul 08, 2022 9:54 pm
by Muppet9010
When a prototype has a selection_box (possibly also collision_box ?) set to be non centered, this is placed based on the entities 4 main directions (N, E, S, W) cleanly, but for the extra rotations (NE, SE, SW, NW) in an 8 way rotatable entity the offsets are always as if the rotation is north.
Example selection box specification on a rail signal: `selection_box = {{0.5, -0.5}, {1.5, 0.5}} -- shifted +1 on the x from center`

In this example a modded rail signal has it's selection box moved offset from the centre of the entity. The aim was to get it towards the middle of the rails so that rails could be built directly next to each other with the signals embedded in the rails.
The rail signal graphics has a hard coded shift in their graphic a tile to the left, this is irrelevant from the bug. The collision boxes are default and show where the signals really are.

In the below picture the North, East, West and South orientations of the custom rail signal all have their selection boxes moved towards the centre of the rails due to their rotation as expected. These selection_box's are highlighted green in the picture.
The NorthEast, SouthEast, SouthWest and NorthWest orientations of the custom rail signal all have their selection boxes shifted east, this is the same as the North direction. These selection_box's are highlighted yellow. This is the issue that Factorio isn't rotating or offsetting these based on their direction. Obviously Factorio does this for vehicles with their orientations, but doesn't seem to for non orientation entities.
8 way rotated selection_box.PNG
8 way rotated selection_box.PNG (850.04 KiB) Viewed 1162 times

Mod:
Factorio-Embedded-Rail-Signals.zip
(7.43 KiB) Downloaded 70 times
Save:
8 way rotated selection box.zip
(1.53 MiB) Downloaded 69 times

Re: [1.1.61] Selection box doesn't handle 8 way rotations correctly when set in a custom entity prototype

Posted: Fri Jul 08, 2022 10:23 pm
by Loewchen
Ref.: 101612

Re: [boskid][1.1.61] Selection box doesn't handle 8 way rotations correctly when set in a custom entity prototype

Posted: Fri Mar 10, 2023 12:31 am
by boskid
Thanks for the report. Issue is now fixed for 1.2.0. I do not want to back-port this fix to 1.1.x.