Arbitrarily long object vector

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
Raff1
Posts: 7
Joined: Tue Nov 03, 2009 11:09 pm

Arbitrarily long object vector

Post by Raff1 »

I was trying to make an arbitrarily long object vector with sphereNodes. I thought that vectors might be the way to go, and I managed to get a row of balls like the first one bounce up and down from different heights. My problem is that i don't seem to be able to adjust individual properties like texture and size. In the code below I have extended the 04.Movement tutorial and kept the original sphere. I try to shrink it and remove its texture. However, it gets the texture and size from the assignment I do in the loop for the other spheres.

Here is the relevant part of the code.

Code: Select all

	scene::ISceneNode * node = smgr->addSphereSceneNode(0.07);
	if (node)
	{
		node->setPosition(core::vector3df(0,0,30));
		//node->setMaterialTexture(0, driver->getTexture("/path/irrlicht-1.6/media/fire.bmp"));
		node->setMaterialFlag(video::EMF_LIGHTING, false);
	}


std::vector <scene::ISceneNode *> balls;

	for (int i = 0; i < Nballs; i++)
	{
		balls.push_back(smgr->addSphereSceneNode(balldiam/2));
		balls.at(i)->setMaterialTexture(0, driver->getTexture("/path/fire.bmp"));
		balls.at(i)->setMaterialFlag(video::EMF_LIGHTING, false);
		balls.at(i)->setPosition(coords.at(i));
	}
What is the best way of arranging such a set of shapes? And whats might be my problem?
squisher
Competition winner
Posts: 91
Joined: Sat May 17, 2008 2:23 am
Contact:

Post by squisher »

Sounds like a problem with your code. As far as Irrlicht is concerned this shouldn't be an issue. Can you paste the main.cpp from your modified 04.Movement example?
Raff1
Posts: 7
Joined: Tue Nov 03, 2009 11:09 pm

Post by Raff1 »

squisher wrote:Sounds like a problem with your code. As far as Irrlicht is concerned this shouldn't be an issue. Can you paste the main.cpp from your modified 04.Movement example?
Yup! Tidied up a bit and the problem ceased. I guess it was some kind of pointer issue. Hopefully I will be able to sort out my movement problems now that I got the graphics in order :-)
Post Reply