Hello, i’m trying to animate the gun with the floating arms but i want them to be separate entities. I rigged a model and added it a idol pistol animation then i removed the arms from the body on blender. Then i added a bone to the pistol and attached that bone to the arms. Now the pistol moves with the arms. The problem i’m having is, i want to import the arms and the pistol to PC as separate FBX files but i want to animate them just as it works in blender. I was told to enable the import hierarchy box in the PC settings but when i do that, i can’t drag the glb file to hierarchy. I think i may be exporting the models wrong in a wrong way in blender. This is how they look like:
ok i added the arms and the pistol templates separetely to hierarchy. Then i added animation(legacy) component to the arms and dragged an animation file, but it didn’t work
I imported the pistol as a separate object and followed the same process as i did to the arms but pistol is not moving with the arms during animation. I attached the bone of the gun with the right hand bone of the arms and the pistol was moving with the arms in blender. How can i do the same in Play Canvas?
yes i did. when i hit the play button, pistol moves with the arms. I can send the blender file too. I tried importing the collection as well, still no luck
Ok i figured it out. All i needed to do was making pistol, the child of the hand bone i want it to attach to in Play Canvas. I found it out thx to this post: “How to attach a entity to a bone of a model” and with a friend’s advice
Hey @Ronin if you need a script that attaches a gun to a bone here is the script I am using…
PlayerAnimationHandler.attributes.add('Reparent', {
type: 'entity'
});
PlayerAnimationHandler.prototype.initialize = function () {
console.log(this.entity.model.model.skinInstances);
var base = this.Reparent;
//attach to bone
base.reparent(this.app.root.findByName('insert bone name here'));
//the size of gun
base.setLocalScale(1,1,1);
};