aluminum1 Posted February 26, 2023 Share Posted February 26, 2023 I am getting strange behaviour from getBounds, especially when my sprite is rotated. Consider the following code, which loads up a tank pic (attached). // Convenient PIXI aliases const Graphics = PIXI.Graphics const ParticleContainer = PIXI.ParticleContainer const Container = PIXI.Container const Sprite = PIXI.Sprite // Set up PIXI view let app = new PIXI.Application( { width: 600, height: 600, background: 0x000000, antialias: true, transparent: false, resolution: 1, // resizeTo: window }) app.renderer.view.style.position = "absolute"; app.renderer.view.style.display = "block"; app.renderer.autoDensity = true; document.body.appendChild(app.view) // Add player 1 let player1 = new Container() let player1Tank = Sprite.from("tank body.png") player1.addChild(player1Tank) player1.angle = 30 player1.position.x = 150 player1.position.y = 150 app.stage.addChild(player1) // call player1.getBounds() in the console in Chrome Dev Tools. You will get a rectangle which is bigger by about 8 pixels // or so on all sides than the actual (rotated) tank. If you call player1.getBounds() in the console in Chrome Dev Tools, you get a rectangle which is bigger by about 8 pixels than it needs to be (that "bloat" of pixels varies depending on the rotation of the tank.) Quote Link to comment Share on other sites More sharing options...
Yurii Bilas Posted March 1, 2023 Share Posted March 1, 2023 Hi, @aluminum1! getBounds returns the global bounds in your game's "world" (see https://pixijs.download/dev/docs/PIXI.DisplayObject.html#getBounds). So when you rotate something by 30 degrees, the object will have greater global width and height. Look at the picture: To get the size of the object without the transformations in local coordinates you can use getLocalBounds (see https://pixijs.download/dev/docs/PIXI.DisplayObject.html#getLocalBounds). Hope that helps! Quote Link to comment Share on other sites More sharing options...
aluminum1 Posted March 1, 2023 Author Share Posted March 1, 2023 Yes, I am aware that when you rotate a rectangle, the width and height of its axes-aligned rectangular bounds will increase. But, PixiJS is still overestimating the bounds by about 8 pixels or so of that axes-aligned box, even taking that into account! In other words, the axes-aligned rectangular bounds of the rotated rectangle is bigger by about 8 pixels or so than it needs to be. This is apparent when you run the above code and look at the bounding box that PixiJS returns. Quote Link to comment Share on other sites More sharing options...
Yurii Bilas Posted March 1, 2023 Share Posted March 1, 2023 How do you know that it's bigger by 8 pixels? Have you done some calculations? Quote Link to comment Share on other sites More sharing options...
aluminum1 Posted March 1, 2023 Author Share Posted March 1, 2023 Well, I plotted rectangle that was returned by PixiJS, i.e. I asked for the bounding box of my tank, then I plotted that rectangle, and I noted that it was quite a lot bigger than the axis-aligned bounding box of the tank. You can see this most easily if you install the PixiJS debugging extension on Chrome, then you can click on any object and see its bounding box. Quote Link to comment Share on other sites More sharing options...
Yurii Bilas Posted March 1, 2023 Share Posted March 1, 2023 Please note that the pixijs debugging extension is sometimes showing wrong bounding boxes! I tried using it, too, but it had lots of issues. Quote Link to comment Share on other sites More sharing options...
Yurii Bilas Posted March 1, 2023 Share Posted March 1, 2023 Also your bounding box may be bigger if you add any other children objects. Please make sure that there is only one object. Quote Link to comment Share on other sites More sharing options...
Yurii Bilas Posted March 1, 2023 Share Posted March 1, 2023 @aluminum1 Well, I've tested your code & image. And it's working fine. Please, take a look at this playground:https://www.pixiplayground.com/#/edit/5giN3i08GpFkgknzh49vX Backup for code just in case someone stumbles on this topic and the link doesnt work: // Convenient PIXI aliases const Graphics = PIXI.Graphics const ParticleContainer = PIXI.ParticleContainer const Container = PIXI.Container const Sprite = PIXI.Sprite // Set up PIXI view let app = new PIXI.Application( { width: 600, height: 600, backgroundColor: 0x555555, antialias: true, transparent: false, resolution: 1, // resizeTo: window }) app.renderer.view.style.position = "absolute"; app.renderer.view.style.display = "block"; app.renderer.autoDensity = true; document.body.appendChild(app.view) // Add player 1 let player1 = new Container() let texture = PIXI.Texture.from("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABSCAYAAADD2VOmAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAa/klEQVR42s2cf4wcyXXfP/WmtjkeDcarvRW9t7fhMQzDnGlKuNwpMiEbigxLOcEI7CQGHAewAMcwBMGSHQRBEtj+w0CQIH/FChJAgBNFUBxBf9iy4iiCE9vCwVKIM0HRlwvF8Bhqtd7jrVdzq9Xc3mRurtlb89p/VHV3dU8Pd5c8GdfEcnd6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wnSAbuUkL7hcLczMOZNLfG9P88+OPGKoubxn43JrcEmSfixfnudxGJPBTPJhi0MrMGesujUkW2GRFBp5jaakVZ//DTJckBwnd86toikCOAOlf3/PcRtupj7zAPzznd1L/3QHi2VxXHx45foP9oP4bP6liJFNGz0rQMmowmCsP/CEHcrC8FUP+LQkye55M39ofTomTWqDsNz34J76dc2tsilsQ/qiVa1zlFl1V7ljHSrEFFbbq5DtBerBUmj3cEp9st+Cx+RxMmq3w8r3l04aIRic1lIFdKQS44tgtayRmnuPB5CjFLsCN7YQby4XuQtTrWFoFqfRzFvE/YcW7Q7eiRjfw4/09m3BGSiYAAAAABJRU5ErkJggg=="); let player1Tank = Sprite.from(texture) player1.addChild(player1Tank) player1.scale.set(2) player1.angle = 30 player1.position.x = 150 player1.position.y = 150 app.stage.addChild(player1) const graphics = new PIXI.Graphics(); app.stage.addChild(graphics); app.ticker.add(function(delta) { player1.rotation += 0.005 * delta; const bounds = player1.getBounds(); graphics.clear() graphics.beginFill(0xff0000, 0.5); graphics.drawRect(bounds.left, bounds.top, bounds.width, bounds.height); graphics.endFill() }); Quote Link to comment Share on other sites More sharing options...
aluminum1 Posted March 1, 2023 Author Share Posted March 1, 2023 Thank you for this. Much appreciated. I will have to dig down and understand the root of the supposed issue on my end. 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.