Attaching models

Probably a dumb question but say I have a sword on the ground in my scene and my character picks it up. How do I attach the sword to the character?

Assuming you’re using a character with a skeleton, you can use the following:

[java].getControl(AnimControl.class).getAttachmentsNode(“name of the bone”);[/java]

To get for example the “hand bone”. Then you can attach a model as per usual on it, and it will follow the charaters hand movements.

1 Like

Awesome thank you!

So that line will attach the sword model to my character model or does it only follow the animation of the hand or both?

Ah, no. That line only gets the node associated with the bone.

You then need to attach it, like you do with any spatial, using


Have a look at for a better reference on the subject

I see! Thank you!