How do i know the bones name?

  1. Setup your project and click launch

  2. In a launched window go to console

  3. Enter this: (‘YourEntityNameHere’).model.model.graph.getChildren();

  4. You’ll get an array of child nodes of GraphNode type. Expand them to read their name fields. Some of them will be skins, but one will be sceleton root - it my case it reads Character1_Hips.

  5. Expand children of this root further in the console to see your sceleton hierarchy.

Hello, thanks a lot…i also have found that if i click on the animation json file and download i can see the file where all the bones are showed, but it isn’t easy with every animation file coz of the complexity of the bones.

Where do i do wrong?

lhand = app.root.findByName('Player').findByName('Model').model.findByName('Bip01 I Mano');

Break it down and use the debugger to check what’s going wrong.

var playerEntity = app.root.findByName("Player");
var modelEntity = playerEntity.findByName("Model");
var graph = modelEntity.model.getGraph();
var node = graph.findByName("Bip01 | Mano");

Hi Dave, just found out, put it too early in the code…before the initialize :stuck_out_tongue: my bad…now fighting with attaching the weapon to the bone

hi again,
i used

lhand = this.model.findByName('Bip01 I Mano');

and got:

TypeError: node.getParent is not a function
if(node.getParent() !== null) {

the child ‘shield’ must be an entity in the root? or inside player entity? sorry to ask but i’m confused

lhand.addChild('shield') isn’t valid.

The addChild() method takes an Entity as it’s first argument:

Hi again, i tried this code coz i was going nowhere:

and it says TypeError: modelEntity.model.getGraph is not a function

Here is a code, that will get you a list of all available skin bones in model as object, where key - is a name, and value - is a node (bone) that you can manipulate:

var bones = { };
var skins = this.entity.model.model.skinInstances;

for(var s = 0; s < skins.length; s++) {
    for(var b = 0; b < skins[s].bones.length; b++) {
        bones[skins[s].bones[b].name] = skins[s].bones[b];


Tnx @max i had to change slightly the var skins line coz the script is inside the player entity and not inside the child model, anyway, using alert(bones) i have (object, Object) reply, using console.log(bones) i find nothing :frowning: am i dumb?

Without piece of code, it is not possible to tell what your problem. Please don’t forget providing enough info on issue, including link to source file and link to project.
Possible that your model is not skinned.
here is the code

`var bones = { };
        var skins = this.entity.findByName('Model').model.model.skinInstances;

        for(var s = 0; s < skins.length; s++) {
            for(var b = 0; b < skins[s].bones.length; b++) {
                bones[skins[s].bones[b].name] = skins[s].bones[b];

is inside Player entity, player script line 62 and follows

Do not use alert please, that is sooo old school and annoying. Use dev tools and console.
I get this in console, so it finds all it needs:

1 Like

OK than that means that the bone Bip01 I Mano for the left hand and Bip01 D Mano for the right hand are the right bones to use…i’m lost on how to attach the shield object to the left hand coz the shield keep disapearing sigh

So if you parent shield to a bone of that name, it disapears? Make sure your shield origin pivot is at right place, and take in account possible scaling of bones/shield, that will under/over scale it on reparenting.

I have tried to scale the shield like this

` var scale = this.entity.getWorldTransform().getScale();
this.shield.setLocalScale(1/scale.x, 1/scale.y, 1/scale.z);

don’t know if i have write it the correct way

and i have tried to put the shield as entity in root and as child in player, i also tried to use it just as model or with collision and rigid body attributes…

I’m having similar issues as I am replicating this code for use in my own project. @max is there any way that you could explain why the error “modelEntity.model.getGraph” is not a function?

Thanks so much for your help!

I have also now viewed this article: How to attach a weapon(Gun) to a character bone?, and put in the code there, but it appears that the gun now is not connected to the character at all! Should the entity be in the scene when we add it?

Hi @TheCodeCrafter i solved that problem not using the object in the scene, but using the same object as child of the character (with no rigidbody if i remember correctly). I set is as child and disable it then when needed i enable it and connect it to the bone. At first it didn’t show because it needed to be re-scaled so when initializing the character i rescaled all child objects (shield, sword, etc). You can see the code here studying the player and it’s childs.

Yes thank you @ayrin I also figured it out, I ended up actually still using any object in the scene. Turns out the model component has another .model that you have to use to another .model to get to the .graph

var gun = this.entity;"item").entity.model.model.graph.findByName("LeftHand").addChild(gun);

gun.setLocalScale(1/this.scale.x, 1/this.scale.y, 1/this.scale.z);
// Other various positioning measures were taken, 
// but they weren't necessary for the attachment to the hand itself.
1 Like