Sprite in GridMap?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By ilikelegos
:warning: Old Version Published before Godot 3 was released.

For a game I’m making, I wondered if it is posible to create a MeshLibrary of… well sprites. I know this sounds odd and backwards, but it’s a 2.5D game I’m making that needs to understand where things are in all 3 dimensions, but display in a 3/4 orthagraphic perspective.

Alternativly, if this is possible with a tilemap, or any other decent method, that would also work, I just have no idea how and it sounds like that would need a bunch of wierd workarounds.

Thanks. :slight_smile:

:bust_in_silhouette: Reply From: Zylann

In 3D, a sprite is just a quad, and a quad is a regular 3D model. So in a sense, you can have sprites in a MeshLibrary, however I’m not sure it will result in what you want.

As I said earlier in QA, you can use a tilemap for a 2.5D game, but only as a mean to render the “3D” world. You can fake that with layers, for example if you have a bridge, it will be on a higher layer than the ground, and so on.

If the whole game is 3D and cannot work with “faking”, then you’ll have to move to 3D nodes, but only use 2D ones for display. Not sure if it will work out of the box.
Or if you don’t care about pixel art (because 3D is not flat obviously), you can simply use orthographic projection.

There are otherwise some weird tricks you can look into (too bad I don’t remember where I saw that), where gridmap elements would be oblique sprites that, once looked at from 3/4 orthographic view, look like actual sprites.

Yeah, I’ve trying to work on the math for scaling things correctly to do the last suggestion. I think I’ll just have to go with that. Thanks!

ilikelegos | 2016-08-14 19:14

Wait, how can I put a collection of 2 quads as a tile in a MeshLibrary?

ilikelegos | 2016-08-14 22:11

Well, If you want to use a GridMap, create a mesh containing two quads for every combination possible. Or have two Gridmaps, one for floors, one for walls. Or have both on the same tile, but have an oblique quad (= a mesh containing four vertices. MeshLibrary contain meshes, right?)

Zylann | 2016-08-14 22:53