Godot Version
Godot stable version 4.3
Question
I have an imported model from blender as a Godot scene with some other nodes like an AnimationPlayer and an AudioStreamPlayer. Now I wanted to have a system so that I can bind as many models as I want to any bone of the Skeleton3D of the model. So I came up with this code :
func create_gear(
model_scene: PackedScene,
bone_name: String
) -> Gear:
var model: Node3D = model_scene.instantiate()
var gear: Gear = Gear.new()
gear.add_child(model)
gear.set_use_external_skeleton(true)
gear.set_external_skeleton(skeleton_path)
model_owner.add_child(gear)
return gear
Here model_owner is simply the root of the scene, meaning the parent of the imported model and those other nodes I mentioned, skeleton_path is obtained with this :
get_path_to(find_child("Skeleton3D"))
And Gear is just this :
extends BoneAttachment3D
class_name Gear
Now after running this function the model does appear but it just stays at the origin point of the model and doesn’t follow the bone I want it to. Any ideas why?