Teflo Posted November 6, 2014 Share Posted November 6, 2014 Hey there, great framework you made!But I have one problem. When I scale a group, every sprite gets rescaled, but the bodies attached to them are not. So I tried to scale the bodies with body.updateBounds(); But that didn't change anything. So I took a look in the code and I see, the updateBounds() method doesn't take the group scale into account, but just the sprite scale, which isn't directly affected by group scale. Now I tried to copy the updateBounds() method and edit it, so it uses the scale I want. It seems to be working at first, but somewhere the body size is resetted and I end up with same unscaled bodies. How am I supposed to do it correctly?And just because I'm curious: Is there a good way to let everything be normal and just render the whole thing with a scale? Thanks! Link to comment Share on other sites More sharing options...
eguneys Posted November 6, 2014 Share Posted November 6, 2014 What is this body attached to sprite, is it related to physics? Link to comment Share on other sites More sharing options...
matquango Posted November 13, 2015 Share Posted November 13, 2015 I'm having the same issue. I have a parent group that contains sprite objects with arcade physics bodies enabled on them. When I set the parent group scale, the sprite scale correctly, but their bodies remain at the size they were at creation. Anyone found any solutions? Link to comment Share on other sites More sharing options...
jmp909 Posted November 14, 2015 Share Posted November 14, 2015 for arcade you could do this maybe.. but it does seem like a bit of a workaround for something you'd expect to happen internally.group.forEach(function(sprite) { sprite.body.setSize(sprite.width * group.scale.x, sprite.height * group.scale.y)})although I have some odd collision behaviour here http://phaser.io/sandbox/XzaIExTz/play (scale 2,2 worked ok though) Link to comment Share on other sites More sharing options...
matquango Posted November 17, 2015 Share Posted November 17, 2015 Yeah, this is essentially what I ended up doing. Luckily, I'm not getting the same collision problems as the example you posted. It's not pretty (especially as I continue to add objects since I'm scaling for zoom functionality), but it works! Link to comment Share on other sites More sharing options...
ptotheaul Posted April 18, 2016 Share Posted April 18, 2016 I wanted to reopen this issue because I'm creating a 2.5D game and having the same issue. Is looping through and resetting the body size really the best option? Link to comment Share on other sites More sharing options...
Recommended Posts