[SOLVED] Bone to Bone (coat sleeve to player arm)

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
LunaRebirth
Posts: 386
Joined: Sun May 11, 2014 12:13 am

[SOLVED] Bone to Bone (coat sleeve to player arm)

Post by LunaRebirth »

Hello again,
I've got a problem I can't work out.

I'm trying to make an option to change your coat, and the coat has bones alike to the player bones.

I want to attach the coat sleeve bone to the node arm bone.

I've tried the following:

Code: Select all

IBoneSceneNode* test1 = coatNode->getJointNode("Sleeve1");
IBoneSceneNode* test2 = node->getJointNode("Arm1");
test1->addParent(test2);
This doesn't seem to work?
Last edited by LunaRebirth on Wed Jul 09, 2014 4:03 am, edited 1 time in total.
LunaRebirth
Posts: 386
Joined: Sun May 11, 2014 12:13 am

Re: Bone to Bone (coat sleeve to player arm)

Post by LunaRebirth »

I've also just tried doing:

Code: Select all

coatNode->setJointMode(EJUOR_CONTROL);
coatNode->getJointNode("Sleeve1")->setPosition(node->getJointNode("Arm1")->getPosition());
Also failed.

EDIT:

Code: Select all

coatNode->getJointNode("Sleeve1")->setParent(node->getJointNode("Arm1"));

Failed.
LunaRebirth
Posts: 386
Joined: Sun May 11, 2014 12:13 am

Re: Bone to Bone (coat sleeve to player arm)

Post by LunaRebirth »

I understand how to attach nodes to bones, as such:

Code: Select all

IAnimatedMesh* coatNode = smgr->addAnimatedMeshSceneNode(coatMesh);
IBoneSceneNode* coatBone = coatNode->getJointNode("Bone");
coatNode->setJointMode(irr::scene::EJUOR_CONTROL);
coatNode->setMaterialTexture(0, driver->getTexture(imgPath));
coatNode->setMaterialFlag(EMF_LIGHTING,false);
 
coatNode->setParent(coatBone);
But if I try to attach each bone rather than node on bone, it doesn't seem to work...?
LunaRebirth
Posts: 386
Joined: Sun May 11, 2014 12:13 am

Re: [SOLVED] Bone to Bone (coat sleeve to player arm)

Post by LunaRebirth »

Nevermind, I was really overthinking this problem.

I made the coatNode attach to the player node, so the coat aligns to the player's body.
The body sleeves weren't moving, and I thought I had to use setPosition().
Turns out, I can just do this:

Code: Select all

coatNode->getJointNode("Sleeve1")->setRotation(node->getJointNode("Arm1")->getRotation());
And it works!
Sorry, would remove this dumb post if I could.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: [SOLVED] Bone to Bone (coat sleeve to player arm)

Post by CuteAlien »

We usually keep threads. Then the next person running into the same troubles might get pushed in the right direction :-)
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply