poz Posted August 30, 2017 Share Posted August 30, 2017 Hi Phaser community, It is my first project with Phaser, I am struggling with devicePixelRatio and physics (arcade) body on ipad. When I set the Phaser.Game resolution to 2 (iPad pixel ratio) my sprites are resizing correctly, but the bodies are still positioned as if the resolution was 1. So the body are not positioned on sprites. Does this ring anyone's bell ? How could I match the body position with the sprite position ? Thank you Link to comment Share on other sites More sharing options...
samme Posted August 30, 2017 Share Posted August 30, 2017 I don't really understand how game.resolution is supposed to work with sprite textures. If you use game.resolution=2 and a 100 ×100 image, the sprite is drawn at 100 ×100 renderer px → 50×50 game px, but the sprite's dimensions (width, height) are still 100×100 game px. Link to comment Share on other sites More sharing options...
poz Posted August 30, 2017 Author Share Posted August 30, 2017 Hi Samme, Thank you for looking into it, I was thinking that resolution was used for device pixel ratio, but I also found the same positioning problem with the inputs debug, they are drawn as if the world was in resolution 1. I finally found a solution, I keep the resolution to 1 and set scaleMode to USER_SCALE and set the user scale to 0.5 (would be 1/devicePixelRatio for other devices) this.scale.scaleMode = Phaser.ScaleManager.USER_SCALE; this.game.scale.setUserScale(0.5); samme 1 Link to comment Share on other sites More sharing options...
Recommended Posts