[1.1.53] Off-center collision box misbehavior when rotating entity

This subforum contains all the issues which we already resolved.
Post Reply
sparr
Smart Inserter
Smart Inserter
Posts: 1327
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

[1.1.53] Off-center collision box misbehavior when rotating entity

Post by sparr »

Code: Select all

local entity = table.deepcopy(data.raw["constant-combinator"]["constant-combinator"])
entity.name = "turntable"
entity.collision_box = {{0.0, 0.0}, {1.5, 1.5}}
data:extend({entity})
This entity has an off-center collision box. Sadly I couldn't make it farther off center, but that's another feature request for another day. When you rotate this entity with debug view of collision boxes on, the collision box moves in the expected way. When the collision box is southwest or northwest of the entity and you try to place another entity in a way that collides, you will be blocked, as expected; i.e. there is a 2x2 group of tiles where you can't place an inserter or other single tile entity. However, when the collision box is northeast or southeast of the entity, the effective collision box is smaller than the one drawn, and the area blocked is only 1x2 tiles instead of the 2x2 that it should be.

Please let me know if you need screenshots or a video of this.

User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 2240
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [1.1.53] Off-center collision box misbehavior when rotating entity

Post by boskid »

This bug report uncovers a huge flaw related to rotating entities. To see the issue you can use `show-selected-entity-advanved-tile` and hover over your "turntable". Issue is that when entity is placed on a surface it registers itself on multiple advanced tiles to be found during various collide checks, but your turntable has a collision box that is not rotational symetric around entity position. If you build the turntable when it occupies southeast, it only registers on 1 advanced tile and rotating twice to occupy northwest will not update advanced tiles it is registered on so it will fail to collide with entities built on top and left of it as long as entity being built is not occupying advanced tile the turntable is registered on. When building this turntable so it occupies northwest, it will register on 4 advanced tiles and when it rotates it will not reregister itself but will be occupying all 4 of those advanced tiles. From this it looks like the turntable(type=constant-combinator) is faulty because it does not reregister on the surface during the setDirection, but i also noticed other entities (like steam-engine(type=generator), heat-exchanger(type=boiler), pump(type=pump), flamethrower-turret(type=fluid-turret)) to be faulty. Vehicles are not faulty because they are properly reregistering on the surface when they change orientation.

ps. feature request for allowing collision box to not contain {0,0} is rejected. There is a huge assumption here and we cannot simply drop this assumption. Cliffs already have collision box not contain the {0,0} in certain orientations but they are still guaranteed to be on the same advanced tile.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13198
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [1.1.53] Off-center collision box misbehavior when rotating entity

Post by Rseding91 »

Thanks for the report. Boskid and I fixed it for the next release.
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Resolved Problems and Bugs”