Page 1 of 1
Changing pivot point of inserter arm?
Posted: Tue Oct 20, 2020 10:28 pm
by Deadlock989
I'm experimenting with steam-powered inserters on an inline (input-output) pipe. Before I go to the trouble of making sprites, I want to be sure it can work.
The "pivot point" of inserter movement seems to be hardcoded to the exact centre of the tile. All the inserter bases are designed so that the centre of the platform's circular base is aligned with the tile centre, regardless of direction. This doesn't work well with the weird perspective of pipes. Those are aligned such that from the isometric viewpoint, they are always visually centred on the tile. But the eye is still translating everything as 3D and pipes are much taller than the inserter platform. When you combine them you get this (test just by jamming different sprites together):

- pipeserters.png (342.08 KiB) Viewed 2743 times
The pivot point of the arm appears to be down one side in the horizontal (east-west pipe, north-south inserter) version. It doesn't look too bad when the inserter is reaching south but it's awkward when it rotates north. In the north-south pipe where the inserter is picking east-west, the pivot point is too far south and it would be impossible to fit a "platform" in there. Ideally the pivot point should be where the centre of the windows is on the regular pipes shown, about a quarter of a tile higher up.
Things I have tried:
- adding a shift to the various arm parts (chaos ensues as different parts of the arm fly apart and reform wildly in space, depending on inserter direction)
- moving the inserter's collision box off-centre (nothing happens)
Is there anything I'm missing or should this be a feature request?
Re: Changing pivot point of inserter arm?
Posted: Tue Oct 20, 2020 11:45 pm
by eradicator
Is "placeable-off-grid" an option for your usecase?
Re: Changing pivot point of inserter arm?
Posted: Wed Oct 21, 2020 8:34 am
by Deadlock989
eradicator wrote: Tue Oct 20, 2020 11:45 pm
Is "placeable-off-grid" an option for your usecase?
I don't believe so. The use case is literally a steam powered inserter. The steam powered part works (as well as any fluid-powered entity works). So it needs to be aligned to the grid because it needs to connect to the pipe grid. Unless you're suggesting shenanigans with proxy items and something that is visually not where it really is. I guess that might be gotten to work eventually ... Seems like a song and dance just to shift something 12 pixels.
Plan B is to have it only connect to undergrounds, which makes all of these problems vanish. The floor position where undergrounds go under is almost out of the tile but we accept it and it's low enough to have a tile-centered inserter platform above it. The only drawback is that it's not a very intuitive mechanic, there is no vanilla entity that only connects to undergrounds except other undergrounds.

- pipeserters.png (595.26 KiB) Viewed 2689 times
Re: Changing pivot point of inserter arm?
Posted: Wed Oct 21, 2020 10:14 am
by Deadlock989
Yeah, it just works better as a two-way underground pipe. Except for the fluid box filter icon being double-overdrawn in alt-mode and the blue pipe connections being visible always in alt-mode, but those are minor things.

- pipeserters.jpg (151.69 KiB) Viewed 2670 times
Re: Changing pivot point of inserter arm?
Posted: Wed Oct 21, 2020 12:35 pm
by Klonan
Deadlock989 wrote: Tue Oct 20, 2020 10:28 pm
Is there anything I'm missing or should this be a feature request?
Looks like its hardcoded to the entity position, but from a brief look, it looks like it wouldn't be too hard to make it a prototype configurable value,
Feel free to make a modding interface request
Re: Changing pivot point of inserter arm?
Posted: Mon Nov 02, 2020 8:04 pm
by Deadlock989
Failed attempt 2,834:

- Untitled5.jpg (124.75 KiB) Viewed 2530 times
There just isn't enough space. Pipe perspective is already seriously weird, when you combine that with the need to have the centre of the inserter platform in the centre of the tile ... you have literally pixels left to work with.
Re: Changing pivot point of inserter arm?
Posted: Mon Nov 02, 2020 8:37 pm
by darkfrei
Deadlock989 wrote: Mon Nov 02, 2020 8:04 pm
Failed attempt 2,834
Very nice pipe graphics!
Re: Changing pivot point of inserter arm?
Posted: Mon Nov 02, 2020 10:07 pm
by pleegwat
And if you lower the pipes themselves as well?
Re: Changing pivot point of inserter arm?
Posted: Mon Nov 02, 2020 10:58 pm
by Deadlock989
pleegwat wrote: Mon Nov 02, 2020 10:07 pm
And if you lower the pipes themselves as well?
They'd be clipping the ground and/or wouldn't connect properly.
This is irresistible force / immovable object territory. Pipes have to look they line up with the centre of each tile edge - there is zero freedom around that unless you are reskinning the entire game because every vanilla sprite with a pipe connection makes that assumption and any fluid box can connect to any other fluid box (there is no way in the game engine of stopping different kinds of pipe and entity fluidbox from connecting and any scripted attempt to stop it is likely going to break in some situation or other). So I can't move those brass rings at the tile edges - that is where they have to be.
On top of that, because of the 45 degree isometric perspective, what looks like a square tile on the screen represents a 1m x 1.414m (square root of 2) rectangle in 3D space, so everything has to be longer along the Y axis if it's going to fill tiles. So where pipes are involved your north-south design has to be different to your east-west design. This is why chemical plants look like M.C. Escher just discovered ketamine.
Meanwhile inserters are even more restricted - the arm connects to the on-screen tile centre no matter which direction the inserter is facing. From a pipe's perspective the only place those two points coincide on the 2D projection of the screen is deep inside the pipe. If any one of these limitations could be relaxed then you could have an inserter arm that looked like it was sitting on top of the pipe. Otherwise there is no getting around this collision of perspectives:

- Untitled3.jpg (377.73 KiB) Viewed 2461 times
So you either connect your steam inserters with undergrounds, which looks OK but isn't actually very nice to play (no vanilla entity connects to undergrounds except other undergrounds), or you have weird inserters-in-a-half-pipe:

- Untitled4.jpg (615.58 KiB) Viewed 2461 times
Re: Changing pivot point of inserter arm?
Posted: Mon Nov 02, 2020 11:17 pm
by boskid
Hm... simply moving center position 0.5 tile up and moving hand vector 0.5 tile down seems to be not enough because now shadows do not match the increased height. This would require some more changes to inserter drawing code.

- 90575-attempt-1.gif (1.18 MiB) Viewed 2449 times
Re: Changing pivot point of inserter arm?
Posted: Tue Nov 03, 2020 11:01 am
by Deadlock989
boskid wrote: Mon Nov 02, 2020 11:17 pm
Hm... simply moving center position 0.5 tile up and moving hand vector 0.5 tile down seems to be not enough because now shadows do not match the increased height. This would require some more changes to inserter drawing code.
I'm starting to think that even if it could be moved up that high (and the shadow were in the right place) it would still look weird, like the Hunchbacked Inserter of Notre Dame. The only reason it would work at all is that inserters are made of elastic and stretching down from that "height" would probably push that illusion too far.
This is my last iteration and I think it's as good as I can get it given the limitations. Actually I quite like it. It makes no sense, but chemical plants make no sense.

- Untitled6.jpg (106.93 KiB) Viewed 2338 times