How to offset sprite so that it looks good when entity rotates?

Place to get help with not working mods / modding interface.
Post Reply
armaggeddon321
Burner Inserter
Burner Inserter
Posts: 5
Joined: Tue Jan 23, 2018 5:07 pm
Contact:

How to offset sprite so that it looks good when entity rotates?

Post by armaggeddon321 »

I am trying to get some sprites to appear properly for locomotives
currently to get the sprite lined up with the selection box I need to add a shift value of

Code: Select all

entity.pictures = 
{
	layers = 
	{{
			...
			shift = {4, -.65},
			...
	}}
}	
is there another way to shift sprites so that this doesnt happen? :

https://imgur.com/a/Cv02PJx

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3700
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: How to offset sprite so that it looks good when entity rotates?

Post by DaveMcW »

Edit the image file and shift it by 64 pixels per tile (32 pixels per tile for low-res).

armaggeddon321
Burner Inserter
Burner Inserter
Posts: 5
Joined: Tue Jan 23, 2018 5:07 pm
Contact:

Re: How to offset sprite so that it looks good when entity rotates?

Post by armaggeddon321 »

that only worked a little, I think the answer sadly is I need to re-render the graphics rotated around a different location

AlveKatt
Long Handed Inserter
Long Handed Inserter
Posts: 65
Joined: Sun Apr 14, 2019 1:44 pm
Contact:

Re: How to offset sprite so that it looks good when entity rotates?

Post by AlveKatt »

It doesn't have wheels at the front, right? You need to make sure you rotate around the center of rotation when on tracks rather than the center of the model. Your sprite sheet will be bigger with a lot of empty space, but I think you have to live with that.

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: How to offset sprite so that it looks good when entity rotates?

Post by darkfrei »

AlveKatt wrote:
Tue Mar 01, 2022 1:37 pm
Your sprite sheet will be bigger with a lot of empty space, but I think you have to live with that.
There is a script for that:
viewtopic.php?p=335708#p335708

AlveKatt
Long Handed Inserter
Long Handed Inserter
Posts: 65
Joined: Sun Apr 14, 2019 1:44 pm
Contact:

Re: How to offset sprite so that it looks good when entity rotates?

Post by AlveKatt »

darkfrei wrote:
Fri Mar 04, 2022 1:04 pm
AlveKatt wrote:
Tue Mar 01, 2022 1:37 pm
Your sprite sheet will be bigger with a lot of empty space, but I think you have to live with that.
There is a script for that:
viewtopic.php?p=335708#p335708
The point is that their trouble is solved by that blank space.

armaggeddon321
Burner Inserter
Burner Inserter
Posts: 5
Joined: Tue Jan 23, 2018 5:07 pm
Contact:

Re: How to offset sprite so that it looks good when entity rotates?

Post by armaggeddon321 »

yeah I ended up re-rendering the sprites so they rotated around the entity's rotation point, because I originally rendered them for the sprite's center of rotation
that was the result I wanted
I wasnt worried about the empty space so much

Post Reply

Return to “Modding help”