Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DynamicLayer - wrong bounds with scrollFactor #3893

Closed
Zax37 opened this issue Aug 5, 2018 · 5 comments
Closed

DynamicLayer - wrong bounds with scrollFactor #3893

Zax37 opened this issue Aug 5, 2018 · 5 comments

Comments

@Zax37
Copy link

Zax37 commented Aug 5, 2018

Test steps:

  1. Open and run this example:
    http://labs.phaser.io/edit.html?src=src/game%20objects/tilemap/tests/visual%20culling%20check.js

  2. Look at the small red, pink and yellow tiles. Move camera right. They disappear.

Any ideas why the bounds are not computed correctly? As I test that on different Phaser versions, it seems to be fine in 3.6, but broken in 3.7.1 and above.

@photonstorm
Copy link
Collaborator

photonstorm commented Aug 6, 2018

The issue is the tile culling (rather than the scrollFactor) because it was assumed that the LayerData baseTileWidth and baseTileHeight properties were authoritative, but it appears we need to use those from the Tilemap itself, not any of the layers, to get a true bounds. I've updated the Cull function to use this and the test works fine now.

Just pinging @mikewesthad - can you see anything wrong with the current approach in https://github.com/photonstorm/phaser/blob/master/src/tilemaps/components/CullTiles.js ? It passes whatever I throw at it, but there's so many weird edge-cases in tilemaps who knows.

@Zax37
Copy link
Author

Zax37 commented Aug 6, 2018

This did not fully fix the issue. Open same example, add this line:

layer3.setScrollFactor(0.5);

Same thing happens.

@photonstorm
Copy link
Collaborator

This is taking up far too much time, so, for now, I'm disabling culling entirely on a layer if you have a scroll factor <> 1. Renders fine and will do for now.

@mikewesthad
Copy link
Contributor

mikewesthad commented Aug 7, 2018

I can take a look at cull tiles tomorrow and see if anything jumps out.

Edit: Yeah, what you did with disabling culling entirely for now seems reasonable.

@Zax37
Copy link
Author

Zax37 commented Aug 11, 2018

Seems to work fine in v3.12.0-beta2 :)

@Zax37 Zax37 closed this as completed Aug 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants