I'm new to irrlicht, so please forgive me if I'm asking a stupid question...
How can I copy a scenenode?
I mean... If I have 2 scenenodes
Code: Select all
scene::ISceneNode* Origin;
scene::ISceneNode* Dest;
If I type:
Code: Select all
Dest = Origin
Code: Select all
scene::ISceneNode* Origin;
scene::ISceneNode* Dest;
Code: Select all
Dest = Origin
Code: Select all
irr::scene::ISceneNode * origin = new CCameraSceneNode(0,smgr,1);
irr::scene::ISceneNode * dest = new CCameraSceneNode(0,smgr,2);
*dest = *origin;
Code: Select all
scene::ISceneManager* smgr;
scene::ISceneNode* V2Grp01;
scene::ISceneNode* rotating_node;
[cut]
s16 CreateHand()
{
//Check if model directory is right terminated
[cut]
//Building Hand Model step by step
//ROOT
V2Grp01 = smgr->addEmptySceneNode();
V2Grp01->setName(L"V2Grp01");
V2Grp01->setVisible(this->startVisible);
scene::ISceneNode* dad_GROUND01 = smgr->addEmptySceneNode();
dad_GROUND01->setName(L"dad_GROUND01");
scene::ISceneNode* GROUND01 = smgr->addEmptySceneNode();
GROUND01->setName(L"GROUND01");
dad_Palm01 = smgr->addEmptySceneNode();
dad_Palm01->setName(L"dad_Palm01");
dad_Palm01->setMaterialTexture(1,driver->getTexture("t351sml.jpg"));
scene::ISceneNode* Palm01 = smgr->addEmptySceneNode();
Palm01->setName(L"Palm01");
//PALM
scene::ISceneNode* dad_Palm02 = smgr->addEmptySceneNode();
dad_Palm02->setName(L"dad_Palm02");
scene::ISceneNode* VIFS16 = smgr->addOctTreeSceneNode( smgr->getMesh((ModelDir + "VIFS16.3ds").c_str())->getMesh(0,255));
VIFS16->setName(L"VIFS16");
//PINKY
...
...
Code: Select all
//Build Hand Scene Tree
{
V2Grp01->addChild(dad_GROUND01);
dad_GROUND01->addChild(GROUND01);
GROUND01->addChild(dad_Palm01);
dad_Palm01->addChild(Palm01);
{
Palm01->addChild(dad_Thumb01);
...
...
Code: Select all
switch(event.KeyInput.Key)
[cut]
case INDEX3:
{
rotating_trans = dad_Index03_trans;
rotating_node = smgr->addEmptySceneNode();
*rotating_node = *dad_Index03;
rotating_joint = INDEX3;
}
break;
[cut]
Code: Select all
*rotating_node = *dad_Index03;
Code: Select all
rotating_node = smgr->addEmptySceneNode();
This may compile and run, but it is a very, very stupid thing to do. The SceneNode and derived classes don't implement operator= or copy constructors, so the default implementation just copies the pointers [or arrays of].irr::scene::ISceneNode * origin = new CCameraSceneNode(0,smgr,1);
irr::scene::ISceneNode * dest = new CCameraSceneNode(0,smgr,2);
// do some other stuff
*dest = *origin;
Code: Select all
case KEY_KEY_I: //KEY_UP
{
if ((rotating_joint != THUMB1)&&(rotating_joint != THUMB2)
&&(rotating_joint != THUMB3)&&(rotating_joint != PALM_TRANS))
{
rot.X = rot.X + ROTATION_STEP;
if (((rot.X >= INF_LIMIT_X)&&(rot.X <= SUP_LIMIT_X))
||(rotating_joint == PALM)) //il palmo comunque gira
{
rotating_node->setRotation(rot);
}
}
if (rotating_joint == PALM_TRANS)
{
transl.Y = transl.Y + TRANSLATION_STEP;
rotating_node->setPosition(transl);
}
}
break;