Page 1 of 1

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

Posted: Mon Feb 28, 2022 12:45 am
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

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

Posted: Mon Feb 28, 2022 1:39 am
by DaveMcW
Edit the image file and shift it by 64 pixels per tile (32 pixels per tile for low-res).

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

Posted: Mon Feb 28, 2022 4:58 am
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

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

Posted: Tue Mar 01, 2022 1:37 pm
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.

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

Posted: Fri Mar 04, 2022 1:04 pm
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

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

Posted: Fri Mar 04, 2022 1:43 pm
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.

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

Posted: Sun Mar 06, 2022 10:59 pm
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