[SOLVED] Cannot reparent Entity at runtime?

so originally this line of code worked and the gun would be in the hands of the player but now It doesn’t work…
Same with the Blood and the Bullet belt that is on the player…
anything that has ‘reparent’ doesn’t work now…

PlayerAnimationHandler.attributes.add('Reparent', {
    type: 'entity'
});
PlayerAnimationHandler.prototype.initialize = function () {
//gun
    var base = this.Reparent;
//in the player model/skeleton
    base.reparent(this.app.root.findByName('Chest'));
    base.setLocalScale(1,1,1);
};

Hi @Connor_Briggs,

Are you getting any error?

no errors witch is weird…

Hmm, if you are able share your project or a sample that reproduces the issue. It may be easier for people to help out on this specific issue.

If you need me to I’ll send the link to my project…
I don’t want to publicly send out my project yet…

you know…
I can’t afford the upgrade to not let people to fork my project
I don’t really want people to take my assets

I have band next period so I might be quiet for an hour or 2

It looks like the problem has to do with the Chest entity of your character. If you reparent the entity to another entity, it works as expected. Maybe you can check the character in your modeling software to make sure the Chest entity is correct.

Not sure why, but replacing line 8 of your code above with the line below, solves the problem.

    base.reparent(this.entity.findByName('Chest'));

so the chest a the bone on my player model…

Nevermind the thing you told me to do works :sweat_smile:

thank you

1 Like