Understanding the coordinates

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
Magnet
Posts: 101
Joined: Wed Sep 27, 2006 7:32 pm

Understanding the coordinates

Post by Magnet »

I am create small application:

Code: Select all

smgr->addCameraSceneNodeMaya();
	smgr->getActiveCamera()->setPosition(vector3df(50,30,50));	
	IAnimatedMesh * mesh=smgr->getMesh("../storage/AquaBox/AquqBox.x");
	smgr->getMeshManipulator()->setVertexColors( mesh->getMesh(0), video::SColor( 50, 50, 50, 50 ) ); 
	ISceneNode *Aqua = smgr->addAnimatedMeshSceneNode(mesh);
	Aqua->setMaterialFlag(EMF_LIGHTING, false);	
	Aqua->setAutomaticCulling(false);
	Aqua->setMaterialFlag(EMF_BACK_FACE_CULLING, false);
	Aqua->setMaterialType(video::EMT_TRANSPARENT_VERTEX_ALPHA  );

	Aqua = smgr->addAnimatedMeshSceneNode(mesh);
	Aqua->setMaterialFlag(EMF_LIGHTING, false);	
	Aqua->setAutomaticCulling(false);
	Aqua->setMaterialFlag(EMF_BACK_FACE_CULLING, false);
	Aqua->setMaterialType(video::EMT_TRANSPARENT_VERTEX_ALPHA  );
	Aqua->setPosition(vector3df(10,10,10));

.....
while(...)
{
	driver->beginScene(true, true, SColor(255,100,101,140));
	smgr->drawAll();	
	guienv->drawAll();
	driver->draw3DLine(vector3df(0,0,0), vector3df(100,0,0), SColor(255,255,0,0));
	driver->draw3DLine(vector3df(0,0,0), vector3df(0,100,0), SColor(255,0,255,0));
	driver->draw3DLine(vector3df(0,0,0), vector3df(0,0,100), SColor(255,0,0,255));	
	driver->draw3DLine(vector3df(0,0,0), vector3df(0,0,100), SColor(255,0,0,255));		
	driver->endScene();	
}
ImageImage
But I do not understand, why point 0,0,0 (this centre?) move from one Mesh to second.
This occurs, when I rotate camera.
Tell me about this situation, please.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

you have to reset the transformation matrix, otherwise the location will depend on the order of the meshes drawn. Use driver->setTransformation(core::matrix4())
Post Reply