How to change MeshInstance3D to another?

Godot Version

4.2.2

Question

How to change MeshInstance3D to another?
please, help me
I’d like to change 3D character model’s color using script, idk how to do it.

You can change the mesh property to another mesh resource

$MeshInstance3D.mesh = preload("other_mesh.obj")

not working, do you know how to change skeleton? the entire skeleton to another

Line 14:Value of type “PackedScene” cannot be assigned to a variable of type “MeshInstance3D”.

I need more information because setting the mesh directly to a preload should not work and will produce errors.
Do you have the skeleton in another file? or do you have it on another already instanced object in the scene?

What about this proposal?

var new_mesh = load("res://some_mesh.obj")
$MeshInstance3D.mesh = new_mesh
2 Likes

Sounds like you tried to assign it a glb or tscn file, not an obj mesh resource. If you want to extract the mesh data out of a glb file you can double click it in the editor, select your mesh, check “save to file” and give it a path.

1 Like

thanks, it works!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.