Godot Version
Godot 4.5.1.stable
Question
Hello !
Im trying to do a test for a bigger project, where I need to be able to export glb files on runtime. Went to the doc, and found this :
So tried to apply this exact code, only changing the path and the wanted node. I want to save one of my nodes, which is a MeshInstance3D (with a capsule shape), just for testing purposes.
Am I messing something up with the path ? I’m on linux
Here is my code, basically:
func _input(_event: InputEvent) -> void:
if Input.is_action_just_pressed("export"):
var gltf_document_save := GLTFDocument.new()
var gltf_state_save := GLTFState.new()
gltf_document_save.append_from_scene(self, gltf_state_save)
# The file extension in the output `path` (`.gltf` or `.glb`) determines
# whether the output uses text or binary format.
# `GLTFDocument.generate_buffer()` is also available for saving to memory.
gltf_document_save.write_to_filesystem(gltf_state_save, "user://Downloads/test.glb")
Thank you for your help !!!