Daevid66 Posted May 22, 2014 Share Posted May 22, 2014 Hi, I'm new to Phaser and is starting to test out the features. Like it! Now to my problem:I have converted the demo game starstruck to typescript and try to scale the camera with this.camera.scale.setTo(2,2);The graphics are scaled as expected but not the physics. I've tried with both arcade physics and p2, but none work as expected. I guess someone must have solved this before? Kind Regards, /David Link to comment Share on other sites More sharing options...
Daevid66 Posted May 27, 2014 Author Share Posted May 27, 2014 Bump. I have still not found a solution to this problem. I've tried to reset camera scale before physics update and then set it back, but it's still the same behaviour. I guess I could try to put all objects in a group instead but have seen threads where this also have led to physics problems. Besides having to mess up the structure with an extra group, that needs to be globally accessable in my app. Thanks you any help! /David Link to comment Share on other sites More sharing options...
Zaidar Posted May 27, 2014 Share Posted May 27, 2014 I already had this issue. The way I do is I just multiply the physics calculation by the same scale factor. I know it's not the best way, but the only one I could think about. I have a scaleFactor variable, which depends on differents variables from the device, and just call multiply this variable when needed. I don't think it make too much loss of performance. Link to comment Share on other sites More sharing options...
j0hnskot Posted May 27, 2014 Share Posted May 27, 2014 Try first scaling the camera and then enabling the body of the sprites. Link to comment Share on other sites More sharing options...
Daevid66 Posted June 3, 2014 Author Share Posted June 3, 2014 Thanks for your replies! Zaidar:I'm using the tilemap and can't find a way to scale this properly. j0hnskot:It doesn't seem matter if I scale the camera before or after enabling the bodies. The only solution I've found working is not scaling the camera/layer/group and only scale the canvas. Unfortunately this means that i cannot have sub-pixel movement in the game which is quite limiting when doing subtle animations. /David Link to comment Share on other sites More sharing options...
Recommended Posts