Another observation is that the scale is ignored completely if applied to a parent bone of the hand.
I'm trying to make sense of it - can anyone please explain?
Code: Select all
int main()
{
IrrlichtDevice *device = createDevice(video::EDT_SOFTWARE, dimension2d<s32>(640, 480), 16, false, false, false, 0);
if (!device)
return 1;
device->setWindowCaption(L"Hello World! - Irrlicht Engine Demo");
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
IGUIEnvironment* guienv = device->getGUIEnvironment();
ICameraSceneNode *camera = smgr->addCameraSceneNode(0, vector3df(2, 2, 2), vector3df(0,1,0));
camera->setUpVector(vector3df(0.0f,1.0f,0.0f));
matrix4 projMat;
projMat.buildProjectionMatrixPerspectiveFovLH(45.0f,1.3333f,1.0f,10000.0f);
camera->setProjectionMatrix(projMat);
//create character mesh
IAnimatedMesh* meshPC = smgr->getMesh("../../media/testmodel/mypc.x");
IAnimatedMeshSceneNode* nodePC = smgr->addAnimatedMeshSceneNode(meshPC);
nodePC->setMaterialFlag(EMF_LIGHTING,false);
nodePC->setAnimationSpeed(3000);
//nodePC->setJointMode(EJUOR_CONTROL);
IBoneSceneNode* bone = nodePC->getJointNode("game_HumanLPalm");
bone->setScale(vector3df(3.0f,3.0f,3.0f)); // <----------------- THIS LINE SCALES THE SWORD INSTEAD
//create sword mesh
IAnimatedMesh* meshWP = smgr->getMesh("../../media/testmodel/sword.x");
IAnimatedMeshSceneNode* nodeWP = smgr->addAnimatedMeshSceneNode(meshWP);
nodeWP->setMaterialFlag(EMF_LIGHTING,false);
nodeWP->setParent(bone);
while(device->run())
{
driver->beginScene(true, true, SColor(255,100,101,140));
smgr->drawAll();
guienv->drawAll();
driver->endScene();
}
device->drop();
return 0;
}