Jump to content

Interesting discovery: anchor vs pivot


richpixel
 Share

Recommended Posts

I'm not sure if this has been brought up before...

 

This morning I discovered some 'tearing' in my images. A visible warping across the images which looks like it's related to WebGL breaking the image into triangles and not lining them up properly:

 

continue.png

 

- The image has the smoothed property set to false, in order to get a crisp, unscaled look.

- It's not being scaled either by Phaser or the Canvas.

- The image above has anchor set to 0.5 on x, ie. myImage.anchor.set(0.5, 0);

 

This struck me has a 'half-pixel' kind of problem, so I made sure x,y coords were rounded off but it didn't help.

 

But then I tried the PIXI pivot property:

 

myImage.pivot.set(Math.round(myImage.width * 0.5), 0);

 

And this solved the problem... I don't know what's happening internally to make this work, but I just wanted to share this fix!

 

btw running Phaser 2.2.2, PIXI 2.2.0, WebGL

 

 

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...