How to correctly swap the mesh of a MeshInstance when it's also parented to a Skeleton node?
I was trying to make a character editor with swappable wardrobe, but soon ran into a problem. As I'm still new to 3D and Godot in general, I'm definitely missing something here.
I have the following 3D model I quickly made, and then rigged and animated using Mixamo (for now it only has a single walking animation). It's body is divided into multiple parts like the Arms, Head, Legs and Torso.
I wanted to be able to change the "Torso" mesh into a "Vest" mesh during runtime with the press of a button, so I used the following code which has proven to work in a different test I did before (the code itself is assigned to the Torso's MeshInstance node):
func _on_Button_pressed(): # Load the new mesh var newMesh = load("res://Vest.obj") # Swap the mesh self.mesh = newMesh # Set the material set_surface_material(1, load("res://material2mat.material"))
But of course it wouldn't be that easy. When the button is pressed, the torso part just goes invisible.
If I instead try to swap the mesh using the Inspector, the same result can be seen:
So I would like to know what is it that I'm missing here or if there is another way to do this. In the end, my objetive is to make a game where the player is able swap through different clothes and armor, and for me to accomplish this without a too tedious workflow every time I want to add new wardrobe.
Thanks for your attention.