Code: Select all
class GraphNode
{
public:
GraphNode();
scene::IMeshSceneNode* node;
};
Code: Select all
GraphNode a;
a.node = smgr->addMeshSceneNode(//node properties..);
Code: Select all
cout << a.node->getPosition().X << endl;
Code: Select all
class GraphNode
{
public:
GraphNode();
scene::IMeshSceneNode* node;
};
Code: Select all
GraphNode a;
a.node = smgr->addMeshSceneNode(//node properties..);
Code: Select all
cout << a.node->getPosition().X << endl;
Code: Select all
for(int i = 0; i < num; i++)
{
GraphNode gn = nodes.at(i);
gn.node = smgr->addMeshSceneNode(meshes[0], 0, gn._id, core::vector3df(gn._x,gn._y,gn._z));
cout << gn.node->getPosition().X << endl;
}
cout << nodes.at(1).node->getPosition().X << endl;
Actually, it is not weird at all.so1odo1o wrote: Weird. The code below works but not the one outside the loop:Code: Select all
for(int i = 0; i < num; i++) { GraphNode gn = nodes.at(i); gn.node = smgr->addMeshSceneNode(meshes[0], 0, gn._id, core::vector3df(gn._x,gn._y,gn._z)); cout << gn.node->getPosition().X << endl; } cout << nodes.at(1).node->getPosition().X << endl;
Code: Select all
GraphNode gn = nodes.at(i);
gn.node = smgr->addMeshSceneNode(...);
Code: Select all
GraphNode& gn = nodes.at(i);
gn.node = smgr->addMeshSceneNode(...);