Page 1 of 1

how to attach joint to node

Posted: Sat Nov 25, 2023 10:07 am
by cosmo
Hi,
I need a brief explanation about how to attach joints and nodes, like ad example a weapon to hand bone.
I used this code:

Code: Select all

myChar->setJointMode(EJUOR_READ);
[...]
ISceneNode* hand = myChar->getJointNode("mixamorig:LeftHand");
if (hand)
{
    hand->addChild(weapon);
    hand->updateAbsolutePosition();
}
But, at runtime, the weapon node (previosly in the scene) seems neither to be attached to the hand bone nor to be rendered.

Which is the right way to perform this task?
Thanks.

Re: how to attach joint to node

Posted: Sat Nov 25, 2023 11:47 am
by CuteAlien
getJointNode even seems to set EJUOR_READ already (on first call) and updateAbsolutePosition also only necessary if you want to check position immediately afterwards. Stupid question - but do you actually get the hand node? And are there any messages on console?
Maybe print out the weapons position to see where it ends up.

So in theory it should work already. If it fails I need the involved models for testing, otherwise no clue.

Re: how to attach joint to node

Posted: Thu Nov 30, 2023 5:39 pm
by cosmo
Yeah, the weapon mesh is too small. :oops: As soon as I modified the scale, the issue is solved and the weapon appears in the right spot, just beneth the left hand joint.
My bad, sorry, thanks!

Re: how to attach joint to node

Posted: Fri Dec 01, 2023 12:01 am
by CuteAlien
Haha, happens :-D