Sign in to follow this  
StudioMaker

Wiggly spritesheet when trimmed

Recommended Posts

When i trim my spritesheet then the sprite gets kinda wobbly or something

without trim vs with trim on

https://gyazo.com/f9d1f6cda13325044c35d53d188cc57b

var i = PIXI.Texture.from(t.frames.index[t.i])
, o = new PIXI.Texture(i,new PIXI.Rectangle(i.frame.x,i.frame.y,i.frame.width,i.frame.height))

I'm guessing it is because each frame has a different width and height value as its trimmed, although not entirely sure what the best way to fix this is.

Share this post


Link to post
Share on other sites

Whats the device, what is the size of an atlas, and which format for spritesheet do you use?

It can be 

1. Problem with precision on particular device - PixiJS uses "highp" when its possible but not always. In that case atlas size has to be 4096 or so. One pixel shift maximum.

2. wrong parser of format, wrong "trim".

3. something with both with trim and resolution you set for a spritesheet (wrong division by @2, @3 or something like that)

I'm going to sleep, if you don't want to wait for tomorrow, look at following places, you can place breakpoints there and figure out whats going on for ONE particular frame that you select:

https://github.com/pixijs/pixi.js/blob/dev/packages/core/src/textures/Texture.js
https://github.com/pixijs/pixi.js/blob/dev/packages/spritesheet/src/Spritesheet.js#L196

https://github.com/pixijs/pixi.js/blob/dev/packages/sprite/src/Sprite.js#L261

Edited by ivan.popelyshev

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.