mobileDev

Members
  • Content Count

    2
  • Joined

  • Last visited

  1. Thanks for the reply! I had decided to migrate from v4.8, where I had encountered this issue, to v5 because I noticed it had big chances and maybe the problem would be gone with the new version. But I'm glad you guys were working on it and already have a working solution. I'll be using the dev version of pixi. Thanks again and keep up the great work.
  2. Hi there, I've been trying to generate some textures using PIXI.Graphics for some Sprites. Some of these sprites have their center a bit offset, as in wayyy outside their texture, which is what I want, I want them to rotate around a certain point. So I've used Graphics.drawPolygon and passed an array of vertices to it. So far so good. After that I use the renderer to generate a Texture, and use this to create a Sprite. All seems fine, however when positioning this new sprite with my desired Anchor point, the sprite wouldn't show at the correct location (I do some simple math first on paper to know exactly where the object should show be positioned). So I poke around some more, trying to debug this issue, and I found out that, depending on how the order of the vertices for the object is fed to the Graphics.drawPolygon, I would get different results (of course one is the correct result and the other is the "bug"). Here is an example: https://www.pixiplayground.com/#/edit/id_3MQ2TQ9dXtXb8fX2Ky As it can be seen, both Sprites show up at different locations while having the same properties (Pos, Anchor, Rotation, etc.), except how the texture was drawn: var verts = []; verts.push(0, 0); verts.push(20, 0); verts.push(20, 20); verts.push(0, 20); ... graphicsBox.drawPolygon(verts); ... var spriteCW = new PIXI.Sprite(app.renderer.generateTexture(...)); ... spriteCW.anchor.x = 10; //<--- This will get me the red box on the image verts.reverse(); // !!Reverse the order of the vertices ... graphicsBox.drawPolygon(verts); ... var spriteCCW = new PIXI.Sprite(app.renderer.generateTexture(...)); ... spriteCCW.anchor.x = 10; //<--- This will get me the green box on the image This seem a little bit odd to me, should the order of the polygon affect how it is displayed through a Sprite? I know that working in 3D, the order will determine where the face of the polygon is pointing to, but not the position of the vertices. This might not even be a bug, but I'm not sure what I'm doing wrong or whats the best approach here.