BoneAttachment property wont update

Godot Version

4.2.1

Question

Hey, when i change bone_name’s property of BoneAttachment3D by code, it wont affect when i start the game - i can see in the Editor Remote that this property is empty.

var bone = BoneAttachment3D.new()
bone.bone_name = "TheName"
GeneralSkeleton.add_child(bone)
print(bone_name)

But when i print out bone_name, it shows me that it has the name. Any ideas?

Here you are creating a new bone and adding it to the node tree, but I believe that doesn’t link it to the skeleton. You need to call Skeleton3D.add_bone() to properly set it up.

1 Like

That worked, thx for your time.

For some reason the node, which i reparented “reparent(node, false)” on the bone, doesnt stuck on bones position when animating. Any ideas?

Can you rewrite that question? I do not understand it whatsoever.

Im trying to attach a node to this bone i made, to get its position - it should move with the bone. But when i start an animation, the bone is moving but the attached node is not moving with it

 StaticBody3D.reparent(bone, false)

StaticBody3D by definition do not move!

1 Like

Oh you are right… facepalm. Thx

Edit: Im surprised but the issue remain, even if i go for Area3D or RigidBody3D or CharacterBody3D instead.

var skeleton = get_node("Armature/GeneralSkeleton")
var bone = BoneAttachment3D.new()
skeleton.add_bone(part)
bone.bone_name = part
skeleton.add_child(bone)
var mesh_insta = get_node("Armature/GeneralSkeleton/Mesh)
var colShape: CollisionShape3D = CollisionShape3D.new()
colShape.shape = mesh_insta.mesh.create_trimesh_shape()
var area: Area3D = Area3D.new()
area.add_child(colShape)
mesh_insta.add_child(area)
area.reparent(bone, false)

I need to parent area to mesh first, to make collisionshape work properly.

If someone got an idea, i tried everything

1 Like