pdiddles03 Posted June 13, 2016 Share Posted June 13, 2016 Out of curiosity, how does everyone deal with positioning a object in pixi when the anchor is changed from 0 to something else? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted June 13, 2016 Share Posted June 13, 2016 Only Sprite and BitmapText has anchors, everything else has unknown width/height. Do you use anchor to rotate a sprite, or may be flip it? Quote Link to comment Share on other sites More sharing options...
pdiddles03 Posted June 13, 2016 Author Share Posted June 13, 2016 I am setting the anchor to 0.5 in order to rotate it. I am just curious to those who are using anchors to change things, how do they account for that when positioning to doing collision? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted June 13, 2016 Share Posted June 13, 2016 If you want to rotate by 90 or 180 degree, or flip it, you can do it with texture (http://pixijs.github.io/examples/index.html?s=demos&f=texture-rotate.js&title=Texture%20Rotate&v=dev). As for real rotation, "getBounds()" and "vertexData" (that's only in pixi v4) provide enough info. There was a PR that added special sprite frame stuff: https://github.com/pixijs/pixi.js/pull/2465 , but it got rejected and I'm working on new implementation. Quote Link to comment Share on other sites More sharing options...
pdiddles03 Posted June 13, 2016 Author Share Posted June 13, 2016 I notice that when i use getBounds, it returns the pixels as if I didn't scale the sprite. How do i correct that besides applying a scale variable to it every time i use it? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted June 13, 2016 Share Posted June 13, 2016 1 hour ago, pdiddles03 said: I notice that when i use getBounds, it returns the pixels as if I didn't scale the sprite. How do i correct that besides applying a scale variable to it every time i use it? It cant be. It takes scale into account, I'm sure that you are just doing it wrong. Quote Link to comment Share on other sites More sharing options...
pdiddles03 Posted June 13, 2016 Author Share Posted June 13, 2016 I don't think so, but it is possible. I am scaling my sprites with sprite.scale.x = value and sprite.scale.y = value. The result in getBounds is the original values. Also another question off subject, why do smaller sprites end up blurry somtimes? can i fix that someway? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.