-
Notifications
You must be signed in to change notification settings - Fork 87
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
Is the block_sprite_generator.tscn broken for when we add new Blocks? #106
Comments
I havent used this script in a very long time so maybe it no longer works? It was Godot 3 at the time.
As for why |
Thank you very much for looking into it! Now the script functions, but somehow the sprite being generated wears the texture from the .obj, not the one in-game. For instance: Here we can see that my addition to voxel_library.tres works in-game, with the paler grass, but the sprite generated is the one from the original .object that I had copied from /blocks/grass/grass.obj. I guess for the material to be integrated to the sprite generator too I'll have to go in Blender, will research this. |
It should be using the material you setup in the library:
Also the demo expects blocks to use mesh models, I dont know if it will work if you use cube models, might need some changes for that. |
Working beautifully now! If anyone is faced with the same problem I was faced with, it was because I was creating a voxel_library.tres that was a mix of VoxelBlockyModelMesh (from the Github) and my own creations were VoxelBlockyModelCubes (which appear not to be processed in the same way by block_sprite_generator.gd. So I instead switched my new blocks into Mesh models exported with texture from Blender, using UV mapping to terrain.png. Also don't forget to rename ...sprite_2.png to _sprite.png if you want the new images to show up in the GUI! Thank you so much Zylann, I'm having great fun with this. |
Ugh, that was my testing code I forgot to remove... |
Absolutely wonderful work Zylann.
I'm currently trying to add new types of blocks to the blocky_game demo on Godot. I've been successful at adding them in 3D by editing voxel_library.tres and adding VoxelBlockyModelCube as follows (for instance, this is a grass that is slightly paler green):
By editing blocks.gd, I'm able to add them to the game (see "greengrass" here for instance):
Leading them to be addable in-game:
Now I'm faced with the problem that the sprites aren't generated for the gui for these new blocks (see last picture, empty sprite for that block). It seems that block_sprite_generator.gd is set to start at -1 and the if test in _process never passes because it is always -1. If I tweak those lines by removing the if test, I'm faced with the problem that block.directory does not exist and even fixing it to block.base_info.directory doesn't lead to sprite generation. I get the problem that _mesh_instance.mesh = gui_mesh tells me I'm trying to set a null value.
In brief, it seems like I'm missing something obvious - perhaps there is a manual way to trigger the execution of block_sprite_generator.gd outside the game in a way that it functions? Can any of you help me with this? Thanks a lot and again, Zylann, you have created something very powerful and I thank you for this!
The text was updated successfully, but these errors were encountered: