I bought a Maya object, a model of a dice. I was able to display it properly using a small Irrlicht program.
Next, I tried to rotate it about X-axis, it rotates fine, but for the small problem that, it doesnt rotate about the geometrical center of the dice, it appears to be rotating about a line lying on one of the surfaces of the dice.
I have similar problem when I tried to rotate about Z-axis.
It rotates perfectly symmetrically about the Y-axis.
Here is the program,
Code: Select all
//
//
// g++ -I/home/laeeq/irrl/irrlicht-1.7.1/include -L/home/laeeq/irrl/irrlicht-1.7.1/lib/Linux fl_pyr_2.cc -lIrrlicht -lGL -lXxf86vm -lXext -lX11
//
//
#include <unistd.h>
#include <irrlicht.h>
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
IrrlichtDevice *device;
IVideoDriver *driver;
ISceneManager *smgr;
IMesh *whale_mesh;
IMeshSceneNode *node;
int ang = 0;
int main()
{
device = createDevice(EDT_OPENGL, dimension2d<u32>(640, 480), 16, false, false, false, 0);
if(!device)
{
printf("%s:%u Device couldn't be created.\n", __FILE__, __LINE__);
return 1;
}
printf("%s:%u Device created.\n", __FILE__, __LINE__);
driver = device->getVideoDriver();
smgr = device->getSceneManager();
whale_mesh = smgr->getMesh("Dice.obj");
if( !whale_mesh )
{
printf("%s:%u Whale Mesh couldn't be loaded.\n", __FILE__, __LINE__);
return 1;
}
node = smgr->addMeshSceneNode(whale_mesh);
if(node)
{
node->setMaterialFlag(EMF_LIGHTING, false);
node->setMaterialTexture(0, driver->getTexture("Graphic1.jpg") );
// node->setPosition( vector3df(0, -0.5, 0) );
}
smgr->addCameraSceneNode(0, vector3df(0, 0, -3), vector3df(0, 0, 0) );
while(device->run())
{
ang++;
if(ang >= 360)
ang -= 360;
node->setRotation( vector3df(ang, 0, 0) );
driver->beginScene(true, true, SColor(255, 100, 101, 140) );
smgr->drawAll();
driver->endScene();
}
device->drop();
return 0;
}
I dont know how to attach the maya object, but I might be able to e-mail to any one wanting to duplicate the issue.
I tried experimenting with setPosition() betore rotating, but that didnt help.
Am I missing something here?
Regards