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

[Question] How do set_voxel_metadata and for_each_voxel_metadata_in_area work? #411

Open
clarence112 opened this issue Jul 22, 2022 · 1 comment
Labels

Comments

@clarence112
Copy link

How do set_voxel_metadata and for_each_voxel_metadata_in_area work? Explanations of what they do and how to use them are missing from the documentation.

@MGilleronFJ
Copy link

MGilleronFJ commented Jul 22, 2022

set_voxel_metadata stores the given data into the terrain at the specified position. It will be saved alongside voxel data if a VoxelStream is used. The data can be anything Godot can serialize: bool, float, int, Vector2, Vector3, Array, Dictionary, String etc. Object types wont trigger errors, but saving wont work with them. Cyclic references will not work either. This feature can be used to store sparse data associated with a particular voxel, notably in games working similarly to minecraft (for example, contents of a chest).

for_each_voxel_metadata_in_area iterates through every voxel that contain metadata in the given area, and calls the given function for each of them.

The API documentation is getting outdated since the switch to Godot 4, the doctool needs to be ran again and more descriptions need to be written.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants