Why does scaling a bone does not work?

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
al7
Posts: 8
Joined: Mon Dec 14, 2009 1:22 pm

Why does scaling a bone does not work?

Post by al7 »

With reference to the code and data from the post http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=29365. I'm trying to scale character's hand but it does not do anything, except that it scales the object that is attached to it. (the sword in this case).

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;
}

Post Reply