Group: Fixed To Camera


#1

Hi,

when I have a group and set fixedToCamera = true or iterating over each child and set that property on it, it doesn’t make the group (or all sprites of the group) fixed. It works for all other sprite types but not for a group?

How can I have this effect on a group? Computing the positions in the update function is not micro enough (you can see the lag/delay).

Edit: Also the physics for each sprites within this group does not seem to work. Is it required to enable physics for the group too in order to make the sprites be collidable and stuff?


#2

If i understand your logic, you think that a Phaser group is a set of objects that behave the same when you apply a property on them ?


#3

https://samme.github.io/phaser-examples-mirror/wip/group%20fixed%20to%20cam.html


#4

I solved it using cameraOffset and multiplying the x and y properties of the sprite with the scale factor of the world. This way the prefab is fixed perfectly.


#5

Ok, the approach I had does not work. It seems like the fixed group is still moving in my huge world.
Is there an alternative way where I could simply use “alignIn” function or am I forced to use cameraOffset as my camera is scaled?