-
Notifications
You must be signed in to change notification settings - Fork 164
Tile Rotation (Flipping axis) #55
Comments
Ping. |
@lewster32 what if we rotate the tile so that'll be parallel to the isometric axes? |
Sorry for the delay - yes, you cannot rotate bodies as their edges must be aligned to the isometric axes. Rotating doesn't really make a lot of sense in an isometric scene as due to the sprites being 3D representations, any rotations would typically have to be entirely redrawn (i.e. entirely different frames, rather than just transformations to an existing frame). I don't think I'm entirely understanding what you're trying to achieve, so if you have an example then I can try to be more specific, and maybe suggest workarounds. |
@lewster32 Sorry for my late reply as well, the following is what I'm trying to achieve: BTW: sorry, it's not a usual rotation, we're not using any trig functions, simply flipping x and y axis. Guessing the following does the flipping transformation y=x, after applying it the bouds don't get recalculated. var cow = game.add.isoSprite(100, 100, 0, 'animal-cow-brown', 0);
cow.width *= -1; How do we calculate the bound of an object? I think there must be something wrong with the bounds calculation, they don't seem accurate. |
Does flipping the scale not work? That is how I'd normally do this in Phaser. |
Appears not - the issue seems to be that bounds are initially derived from the sprite size and assumed to be cubic. When changing the scale or width, any non-cubic bounds are not then automatically updated. I guess the workaround is to manually update the bounds yourself when changing the orientation of the sprite, as there is naturally a looser orientation between the sprite and its body with an isometric system; it has to assume some basic things about the sprite, as it cannot interpret any orientation or shape other than the cubic bounds it should occupy for its size. In order to set your own bounds, you would use |
Is the following correct: https://stackoverflow.com/questions/39799689/phaser-how-to-rotate-an-isometric-body
If not, can we rotate the tile like the link above describes?
The text was updated successfully, but these errors were encountered: