How to attach a entity to a bone of a model

can you do that to my npc model plz

You can find it here, under your project settings:

thanks i’ll try that

1 Like

can some body make a simple code with the M-16 model attach to the right-hand bone and make it work with animation

You have to enable the Convert to GLB option first to be able to see the Import Hierarchy option.

If you enabled both options and upload your character again, you can see all of the character’s entities in your hierarchy and add another entity to it.

1 Like
var box = new pc.Entity('cube');
    box.addComponent('model', {
    type: 'box'

box.setLocalScale(30, 30, 30);'MaleBaseMesh:Hips').addChild(box);

i am trying to use this code because it works on the animation and doesn’t lag as badly.
problem is it will load if it is a cube but not any of my gun models

I tried the import option and it just crashed again and again

i tried to change the code above it to my gun models and it said it is already parented and when i reparented it,it wouldn’t load the model at all

Did you already tried something like below (based on your current project)?


no sir i haven’t yet

it just says reparent undefinded

Probably because the capital letter.



well no errors but the model isn’t there

That’s good so far. Try to use the solution from the topic below.

I guess ‘weapon’ in that topic should be your character and ‘weaponOutput’ should be your gun.

thanks for the help i’l take a look at the topic below.
If i can’t get it to work i’t talk later (about to leave for sccocer pratice)

1 Like

I will try it myself tomorrow using the full hierarchy, because I think this is much easier for setting the correct scale and rotation.

so have have looked at the sample project and i am a little confused on how to make my model reappear

There is no example project. The project that you find in the topic is not related to that topic anymore.

I just got it to work thanks so much

1 Like