[SOLVED] Attaching an entity to another's entity node (Putting a gun into a character's hand)

Hey guys, is there any tutorial on how to attach an entity (let’s say a gun) to another’s entity child node (let’s say a character’s hand), considering that hand is animated? I’ve manager to ‘copy’ the worldTransform onto the gun when they are different entities, but that’s should be done in every frame within postUpdate() function, which is pretty boring and laggy (since we have a one frame delay between hand and gun transform synchronization).

So I’m wondering if it’s possible to put a gun into a character’s hand via parenting? (I mean smth like gunEntity.reparent(handNode))?

Hi @Igor,

All model bones get a pc.GraphNode attached to them, which you can use as a regular entity to add children entities in place. Those entities will automatically get transformed as the animations plays.

Check this thread for some helpful code: