Skip to content
This repository has been archived by the owner on May 7, 2022. It is now read-only.

Layer Offset may not be working correctly #156

Open
wollyroche opened this issue Apr 17, 2021 · 5 comments
Open

Layer Offset may not be working correctly #156

wollyroche opened this issue Apr 17, 2021 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@wollyroche
Copy link

Bevy Tilemap version

0.4.0

Operating system & version

Windows 10

What you did

Tried to offset a tile layer to make tiles appear 3D using z_layers, add_layer, and layer_offset.

What you expected to happen

Two things:

  1. Originally I thought that each subsequent tile layer after the first would be offset by the amount specified in layer_offset, but then I thought ...
  2. Wouldn't the layer_offset just offset all layers as it is only a single value on the Tilemap, therefore the whole map would be offset and not individual layers? - is there a way to offset a single layer? Like on the add_layer function?

What actually happened

Nothing was offset.

image

Additional information

This was tested on an alteration of your Hex Tile Odd Rows example.

The only alterations being that I changed the hex to a 3d one and used just a single chunk.

As well as the below code.

image

image

I'm sorry if I'm getting something obviously wrong here, I've tried reading the doc comments on the function calls but I couldn't find any examples in the repo that used layer_offset.

Thanks for any help you might have, you've created an excellent extensible plugin here.

@wollyroche wollyroche added the bug Something isn't working label Apr 17, 2021
@joshuajbouw
Copy link
Owner

joshuajbouw commented Apr 17, 2021

Yeah, once 0.5 hit, lots of stuff was rushed out to get the release in on time. I hadn't made any examples to test all the new features yet. Thanks for filing this.

@wollyroche
Copy link
Author

No problem - just an update that's a little more easier to follow than my custom code above.

I edited the random_dungeon example just to include the call to layer_offset.

image

Which also doesn't offset any layers.

image

Thanks for the reply and the great work

@wollyroche
Copy link
Author

wollyroche commented Apr 17, 2021

I've tried to do some debugging on where the z_offset is used in creating the vertices.

The calculation looks like its working fine, the number of indices is also correct.

Tests done on the hex_tile_odd_rows example.

image

image

image

But it will still only display 1 depth of tiles, not the second offset tiles.

image

I think this might mean that the issue relates to the chunk_dimensions depth rather than the layer_offset?

@wollyroche
Copy link
Author

Did some more testing.

I thought I might have found it as I wasn't adding the z index to the Tile points, which I tried doing.

image

I was sure this would fix it but it still isn't displaying, but I am getting a warning about a tile being out of bounds - even with enough layers added.

image

image

@joshuajbouw
Copy link
Owner

Hmm, thanks for this. I'm quite a bit behind on my game project and it is a requirement for it. I hope to have it resolved shortly.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants